This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Misunderstanding NaN
- From: Bryce Schober <bryce dot schober at gmail dot com>
- To: newlib at sources dot redhat dot com
- Date: Fri, 6 May 2005 14:52:13 -0700
- Subject: Misunderstanding NaN
- Reply-to: Bryce Schober <bryce dot schober at gmail dot com>
I'm using the arm-elf gcc 3.4 toolchain from gnuarm.com, which
includes gcc-3.4.3 and newlib-1.12.0.
I have some double math that is resulting in a bunch of NaN's. One of
the offending equations simplifies to: -41 * (3.14159265358979 / 180 /
16). In gdb I can:
(arm-elf-gdb) p -41 * (3.14159265358979 / 180 / 16)
$3 = nan(0x9d96bbfa6e612)
My windows calculator calculates -0.04472406208 (some "precision"
dropped), but gdb gives:
(arm-elf-gdb) p -0.04472406208
$1 = nan(0x4abdebfa6e612)
This is really strange, since I can subtract 1 and gdb gives:
(arm-elf-gdb) p -0.04472406208 - 1
$5 = -1.04472406208
This is really beginning to confuse me. Any ideas on what's going on here?
--
Bryce Schober