http://www.perlmonks.org?node_id=11155774


in reply to bignum usage?

I wanted to create "bignum usability" SOPW question, but then the SS landed me right here, -- very fresh thread. This pragma is in the core, but how usable/advised/maintained it is?

use strict; use warnings; use feature 'say'; use bignum; # (1) #use bignum downgrade => "Math::BigInt", upgrade => "Math::BigI +nt"; ## (2) #use bigint; say $^V; say my $x = 21778071482940061661655974875633165533182; say my $y = $x / 2;

...

v5.38.0 21778071482940061661655974875633165533182 10889035741470030830827987437816582766590

off-by-one error. Using commented-out lines instead gives me (1):

Deep recursion on subroutine "Math::BigInt::bdiv" at C:/berrybrew/stra +wberry-perl-5.38.0.1-64bit-PDL/perl/site/lib/Math/BigInt.pm line 2229

and the Perl process hangs, or (2):

21778071482940061661655974875633165533182 10889035741470030830827987437816582766591

i.e. "don't use bignum if bigint suffices" will produce the correct answer, but doesn't smell quite right