[Gecode] Testing arithmetic rounding

Christian Schulte schulte at imit.kth.se
Tue Aug 23 20:32:06 CEST 2005


As far as I understand, all modern hardware rounds towards zero. If my
memory serves me right it is event standard for C99 but not yet for C++.

Anybody knows more here...

Guido, if you feel its too messy I could remove it, we do not need it badly.

Christian

-----Original Message-----
From: gecode-bounces at ps.uni-sb.de [mailto:gecode-bounces at ps.uni-sb.de] On
Behalf Of Guido Tack
Sent: Tuesday, August 23, 2005 9:43 AM
To: gecode at ps.uni-sb.de
Subject: [Gecode] Testing arithmetic rounding


Hi.

I've just removed the rounding test from configure.ac and the Makefiles. I 
have replaced it with a check in int/view.icc:

#if (-17 / 7) == -2
#define GECODE_INT_RND_TWDS_ZERO 1
#else
#define GECODE_INT_RND_TWDS_ZERO 0
#endif

This assumes that the preprocessor rounds the same way as the compiler, and
I 
actually have no idea if it always does. This is however the same test we've

been using in configure.ac so far.

Does anyone know a platform where rounding is not defined towards zero? I'd 
just like to test if the preprocessor rounds the same way there.

Cheers,
	Guido

-- 
Guido Tack
Programming Systems Lab, Saarland University, Saarbrücken
http://www.ps.uni-sb.de/~tack

_______________________________________________
Gecode mailing list
Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode





More information about the gecode-users mailing list