[Gecode] Testing arithmetic rounding

Christian Schulte schulte at imit.kth.se
Wed Aug 24 13:42:45 CEST 2005


Hmmm, maybe the test is wrong... It is really for integers. I have to
recheck the nonsense I did there...

Christian

-----Original Message-----
From: Guido Tack [mailto:tack at ps.uni-sb.de] 
Sent: Wednesday, August 24, 2005 1:21 PM
To: schulte at imit.kth.se; Technical discussions about Gecode
Subject: Re: [Gecode] Testing arithmetic rounding


> 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...

As I said, I found it in the C++ standard:

4.9 Floating-integral conversions
An rvalue of a floating point type can be converted to an rvalue of an
integer 
type. The conversion trun-
cates; that is, the fractional part is discarded. The behavior is undefined
if 
the truncated value cannot be
represented in the destination type. [Note: If the destination type is bool,

see 4.12. ]

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

As far as I can see, we should remove the test, not the code ;-)

Guido

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





More information about the gecode-users mailing list