in reply to Re: Re: Why are hex numbers inside strings extrapolating to numbers (incorrectly)?
in thread Why are hex numbers inside strings extrapolating to numbers (incorrectly)?
Tye believes its a problem with the stdlib call atof() and I tend to agree (the same version of Perl produce different results on different OS's).
From my Linux box with glibc 2.1.3 (that caused the strange float point results with Perl):
and from my Solaris 2.6 box (which produced "0" with Perl):nicholas@neko/3:(pts-0.neko) ~/tmp > cat test.c #include <stdlib.h> int main(void) { printf("%f\n",atof("0x9")); } nicholas@neko/3:(pts-0.neko) ~/tmp > cc test.c -o test ; ./test 1.125000
nicholas@peacock2/5 ~ > cat >test.c #include <stdlib.h> int main(void) { printf("%f\n",atof("0x9")); } nicholas@peacock2/5 ~ > cc test.c -o test; ./test 0.000000
|
|---|