in reply to 52-bit numbers as floating point
Spreadsheet::WriteExcel will work on the majority of Windows, UNIX and Macintosh platforms. Specifically, the module will work on any system where perl packs floats in the 64 bit IEEE format. The float must also be in little-endian format but it will be reversed if necessary. Thus:
print join(" ", map { sprintf "%#02x", $_ }
unpack("C*", pack "d", 1.2345)), "\n";
should give (or in reverse order):
0x8d 0x97 0x6e 0x12 0x83 0xc0 0xf3 0x3f
So, as I read it, if you aren't concerned about portability, the following should work:
(remove the reverse bit if your box is big-endian. I'm assuming it's not, since you mentioned ActiveState..)my $dfloat=unpack("d",reverse($yourbigendian));
Update: Seems I was a bit confused about what format he did have the numbers in. ( In my defense, I'm still not clear :) Perhaps a pointer to the IEEE double format would make this node somewhat useful ? See This page from Sun
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: 52-bit numbers as floating point
by John M. Dlugosz (Monsignor) on Aug 08, 2002 at 14:38 UTC | |
|
Re: Re: 52-bit numbers as floating point
by John M. Dlugosz (Monsignor) on Aug 08, 2002 at 03:52 UTC |