printf "% 25.17g\n", -8.2727285363069939e-293;;
-8.2727285363069883e-293
Yeah, I get the same with mingw-built x64 5.22.0.
This is
the perl bug I alluded to in my first post that mis-assigns values by up to a few ULPs.
If you check the hex format (assigned by perl) of -8.2727285363069939e-293 you'll find:
C:\_32>perl -le "print scalar reverse unpack 'h*', pack 'd<', -8.27272
+85363069939e-293;"
834a6aec8f94134c
However, the correct hex format of -8.2727285363069939e-293 is 834a6aec8f941351.
834a6aec8f94134c does in fact correspond to -8.2727285363069883e-293 - so perl is doing the conversion from internal form to decimal string correctly. It's just the initial conversion from decimal string to internal form that was incorrect.
Sadly, no-one seems interested in fixing this - though I think that's because of the degree of difficulty rather than actual "disinterest".
If this level of inaccuracy bothers you (as it does me) then one solution is to assign using POSIX::strtod:
C:\_32>perl -MPOSIX -le "print scalar reverse unpack 'h*', pack 'd<',
+POSIX::strtod('-8.2727285363069939e-293');"
834a6aec8f941351
C:\_32>perl -MPOSIX -le "printf '% 25.17g', POSIX::strtod('-8.27272853
+63069939e-293');"
-8.2727285363069939e-293
This way you put your faith in the C compiler and that seems to be a safer bet.
(That's probably good enough, though I'd rather put my faith in the mpfr library.)
Cheers,
Rob