From:

Date:

August 19, 2021 08:18Subject:

Math::BigInt and bigint with non-integersMessage ID:

CAEvoY43T_W2PYDoQtvss1r+mLsXpV2LGxpV2jpSr7L-LVCTuFQ@mail.gmail.comHi! I would like some input on how the Math::BigInt module and bigint pragma should handle non-integers. The current behaviour is rather inconsistent. The new() constructor converts a non-integer to a Math::BigInt NaN: $ perl -MMath::BigInt -wle 'print Math::BigInt -> new("3.16")' NaN A math operation that returns a non-integer, returns a Math::BigInt with the truncated value: $ perl -MMath::BigInt -wle 'print Math::BigInt -> new("10") -> bsqrt()' 3 Math::BigInt with overloading of constants, leave a non-integer as an unmodified Perl scalar: $ perl -MMath::BigInt=:constant -wle 'print 3.16' 3.16 However, when the "bigint" pragma is used for overloading constants, a non-integer becomes a Math::BigInt with the truncated value: $ perl -Mbigint -wle 'print 3.16' 3 I'm not saying that all four cases should return the same value, but returning three different values seems too much. Any suggestions? Cheers, PeterThread Next

**Math::BigInt and bigint with non-integers**by Peter John Acklam- Re: Math::BigInt and bigint with non-integers by Timothe Litt
- Re: Math::BigInt and bigint with non-integers by Dan Book
- Re: Math::BigInt and bigint with non-integers by Peter John Acklam

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About