This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gnu software bugs - long double
- From: David Given <david dot given at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 02 Nov 2013 20:11:16 +0000
- Subject: Re: gnu software bugs - long double
- Authentication-results: sourceware.org; auth=none
- References: <527535B8 dot 9070903 at gmail dot com> <CAPF-yOY7Zmvftk7FKdKSOuE6=LLyRV50SyptuD9BcKr7Lso2Sw at mail dot gmail dot com> <5275451B dot 7000508 at gmail dot com> <CAKOQZ8x+upC1W468DXxD-2H2n5o-hse6H64ExgtOq0Gx6Fp7KQ at mail dot gmail dot com> <52754B76 dot 80906 at gmail dot com> <CAH6eHdSen38r5XNjdbTwZEXDarVnxJXj1sHyh5FW_9JBbCVMzA at mail dot gmail dot com> <527556F2 dot 4060604 at cyberfiber dot org>
-----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-----