To be sure that my calculations are correct for all cases, I want to see the result (double precision number) as a hexadecimal or binary string. How can I get a hex / binary string or byte representation of this number in Perl ? In Java I could use, for example,
double d = performMyCalculations(); System.out.format("%x\n", Double.doubleToLongBits(d));
for this purpose, and he will print 3fc3333333333333 for 0.15 . How to get a similar result in Perl ?
floating-point perl
m. vokhm
source share