This is a limitation, not of Perl or the module, but of IEEE floating-
point processors. IEEE 64-bit floating point uses 52 bits for the
mantissa, so the maximum integer value that can be represented is 2^52 -
1 = 4503599627370495. Your input value is 17 digits, not 15, so it is
beyond the precision of the processor. The following 15-digit value
gives the expected results:
packeb("p8.2", "9999999999999.00")
By the way, the packeb template gives the number of bytes, not the
number of digits, so "p9.2" is adequate for a 17-digit value.
Unfortunately, the module does not support 128-bit floats ("quads").
Maybe someday.
The limitations of floating-point numbers are well-known, but I
probably should revise the POD to remind people of them.
On Mon Sep 07 12:20:48 2009, joncombe wrote:
Show quoted text> The following code is giving results I think is wrong.
>
> #!/usr/bin/perl -w
>
> use strict;
> use Convert::IBM390 qw(:all);
>
> print packeb ( "p15.2" , "999999999999999.00" );
>
>
> I am getting the 2 digits after the decimal point becoming 04 instead
> of the expected 00. Is this a limitation or a bug?