Re: Int cast / floating point isuses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Joe Hughes" <jhughesjr@xxxxxxxxxxx> writes:

> I'm stumped as to what is causing this error to occur for int cast,
> especially when lrint and trunc seem to work properly.
> 
> Any insight anyone has would be much appreciated.

The default with gcc on x86 is to use 80-bit extended precision
registers, compared with 64-bit on the other architecture.  It gives a
differently rounded result in this case, since the underlying binary
representation is on the borderline between -79.937384... and
-79.9373839999...

Use the rint type functions to round to the nearest integer reliably.

-- 
Brian Gough

Network Theory Ltd,
Publishing "An Introduction to GCC" --- http://www.network-theory.co.uk/

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux