gnu software bugs - long double

David Given david.given@gmail.com
Sat Nov 2 20:11:00 GMT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/11/13 19:48, Mischa Baars wrote:
[...]
> I have written a couple of new trigonometric functions for use in
> the library, and actually I need this to function properly.

The point is that 1.1 simply cannot be represented precisely as a IEEE
floating point number, for precisely the same reasons that 1/3 cannot
be represented precisely as a decimal number (1.3333...). This is
intrinsic to the way that floating point numbers work. If you try,
you'll get the closest number that IEEE floats *can* represent.

If you really need a completely precise representation of 1.1, then
you're not going to be able to use IEEE floats --- you'll have to use
decimals or some sort of fractional representation instead. I don't
know if gcc can help you with those, but there are endless helper
libraries that will do both for you. They're usually pretty slow, though.

- -- 
???? ?????????????? ????? http://www.cowlark.com ?????
? "There does not now, nor will there ever, exist a programming
? language in which it is the least bit hard to write bad programs." ---
? Flon's Axiom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iD8DBQFSdVxhf9E0noFvlzgRAjTFAJ4+UO9b60TkX+/lOa8C/5Hs/XMT3QCcCm8u
k2FWyohiL0rQtLUtotFkS/Q=
=LgFz
-----END PGP SIGNATURE-----



More information about the Gcc mailing list