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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: bignum usage?
by syphilis (Archbishop) on Nov 24, 2023 at 04:52 UTC | |
by Anonymous Monk on Nov 24, 2023 at 09:22 UTC | |
by syphilis (Archbishop) on Nov 24, 2023 at 10:29 UTC |