Doesn't this work for you?:
Well - it doesn't work for me with 32-bit (gcc-5.3.0) builds of perl.
I was looking at 32-bit perl-5.24.0.:
C:\_32>perl -V:archname
archname='MSWin32-x86-multi-thread-64int';
C:\_32>perl -le "print $]";
5.024000
C:\_32>perl -le "$d = unpack 'd', pack 'Q', 0x7ff0000000000001;print $
+d; printf '%f', $d;"
NaN
NaN
That output doesn't tell us anything about the type of NaN we have. However, POSIX::issignaling tells us that $d is
not signalling, and
printf '%x\n', unpack 'Q', pack 'd', $d; outputs 7ff8000000000001.
Things look ok for my 64-bit (gcc-5.3.0) builds of perl.
With 64-bit perl-5.24.0 the output is the same as just given.
But this time POSIX::issignaling tells us that $d
is signalling and
printf '%x\n', unpack 'Q', pack 'd', $d; outputs 7ff0000000000001.
A regards your Inline::C script, the output is as expected given the above results.
32-bit perl-5.24.0 ouptuts:
NaN
7ff8000000000001
64-bit perl-5.24.0 outputs:
NaN
7ff0000000000001
When it comes to Strawberry Perls 5.24.0 (which were built using gcc-4.9.2), I find that both 32-bit and 64-bit are buggy. Your I::C script outputs:
NaN
7ff8000000000001
for both.
I'll try to investigate the problem a little better before I submit any bug reports. It may be that I can tie the behaviour to bugs in the mingw-w64 ports of gcc.
Cheers,
Rob
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.