printf always prints "nan" for double variables on MIPS
blort128 at gmail.com
Wed Feb 28 00:18:11 UTC 2007
Good call, David and Atsushi! You were exactly right, my toolchain
was mixing soft and hard float by mistake. I dug through my
configuration files and found that "Target CPU has floating point unit
(FPU)" was disabled in my uClibc configuration. Once I recompiled my
toolchain properly and tested it out with that option enabled, I was
able to get printf to report the proper floating point values.
That option is kind of a misnomer; It must not have jumped out at me
as being "wrong" due to my processor not having an FPU. Of course,
the documentation explains it clearly enough... that teaches me to not
read the manual first!
It's also clear to me now that using software floating point is
decidedly the better way to go, in terms of performance if nothing
else. At the very least, I learned something from all this, though.
Thanks for your help everyone,
More information about the uClibc