tor. 19. aug. 2021 kl. 16:40 skrev Dan Book <>:
> Truncation to integer seems the most useful and expected behavior to me.
Not sure if the "overloading of constants" case should be affected, would
people depend on it staying unmodified?

I agree on truncation to integer. This is consistent with how Perl treats
non-integers in integer context. E.g., $a[0.9] returns $a[0], not $a[1].

I know nothing about the context in which people use "use
Math::BigInt=:constant" or "use bigint". I would suspect that these are
only used when people are using integers only. As soon as a non-integer
interacts with the overloaded literal integers, it is converted to an
integer (with "bignum")

    $ perl -Mbigint -wle 'print 2 + 3.16'

or a NaN (with "Math::BigInt")

    $ perl -MMath::BigInt=:constant -wle 'print 2 + 3.16'

It seems most sensible to me that both cases should return 5.

It would be nice if Math::BigInt->new("3.16") also returned 3, not NaN as
now. However, people might rely on this behaviour. I might search through
the CPAN modules and see if I can find any use cases.


Reply via email to