No, I think in THIS sitation (which ISN'T taking 0x## as hex numbers) 0x10 is really the same as 0x1, 0x100, 0x183872.
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).
addendum: it definately is the atof() function call that is the issue.
From my Linux box with glibc 2.1.3 (that caused the strange float point results 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
and from my Solaris 2.6 box (which produced "0" with Perl):
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.