in reply to Math With Big Numbers

$bigNumber = Math::BigInt->new(6) ** Math::BigInt->new(25);

Replies are listed 'Best First'.
Re^2: Math With Big Numbers
by syphilis (Archbishop) on Feb 14, 2019 at 22:41 UTC
    $bigNumber = Math::BigInt->new(6) ** Math::BigInt->new(25);

    Or simply:
    $bigNumber = Math::BigInt->new(6) ** 25;
    Perl will print 6 ** 25 as 2.84302880299297e+019 and doing Math::BigInt->new(6 ** 25) therefore becomes Math::BigInt->new(2.84302880299297e+019), which Math::BigInt interprets literally as Math::BigInt->new(28430288029929700000). And that's how AlligatorStamp gets the value he observed.

    With perl, we can also see the actual value by doing:
    C:\>perl -le "printf '%0.f', 6 ** 25;" 28430288029929701376
    And the same should work with AlligatorStamp's perl-5.14.2 ... unless he's running ActivePerl, in which case it will be 28430288029929701000.

    Cheers,
    Rob