For portability, you can just skip pack and store your floating-point numbers as strings. With no extra work, you risk losing only about 3 bits of accuracy in the process (and you can lose that much with just a few arithmatic calculations so this might not be a problem at all).
If those three bits are important, then you can write your floating-point numbers via sprintf "%.20e",$num and read them just the normal Perl way and you won't lose any bits of accuracy between platforms with the same accuracy of floating-point numbers (the best you can do). ["%.20e" should be exact for up-to-64-bit mantissas, which should be overkill for most platforms. "%.16e" is probably all you really need.]
- tye (but my friends call me "Tye")In reply to (tye)Re: newbie: unpacking real numbers
by tye
in thread newbie: unpacking real numbers
by perchance
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |