This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Misunderstanding NaN


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]