I have this snippet with a strange result (279.1... vs. 279.6...):
$ perl -e "print unpack('f>', pack ('f>', 279.117156982422));"
279.617156982422
While this one works
$ perl -e "print unpack('f>', pack ('f>', 279.117256982422));"
279.117248535156
And those ones as well
$ perl -e "print unpack('f<', pack ('f<', 279.117156982422));"
279.11715698242
$ perl -e "print unpack('f', pack ('f', 279.117156982422));"
279.117156982422
What's wrong? Is that a bug in unpacking of non-native endian floating point values?
Note Perl is version 5.14.2 under Cygwin on a PC.
pack
in the first case (I mean, what are the bytecodes)? – Fulminousprint unpack('H8', pack ('f>', 279.117156982422))
to get at the bits returns438b8eff
, which is the correct bit pattern according to this site – Midpointcpan -t Acme::Study::SREZIC
and see if it fails on your system? – Rabelaisian