Skip Menu |

This queue is for tickets about the bignum CPAN distribution.

Report information
The Basics
Id: 17800
Status: resolved
Worked: 40 min
Priority: 0/
Queue: bignum

People
Owner: TELS [...] cpan.org
Requestors: smurf [...] smurf.noris.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Make bignums (optionally) immutable
Bignums do not behave like normal numbers when modifying operations are used. Consider: sub foo($) { my($num) = @_; $num /= 1000; } my $num = new Math::BigInt 12345; foo($num); print "This <$num> should be <12345>.\n"; In other words, replacing integers with bigint in one part of a program can have serious consequences somewhere seemingly unrelated. The solution would be either to use CoW (preferred ;-) , or be able to mark numbers as immutable, so that self-modifying operators throw an error.
On Wed Feb 22 09:49:36 2006, guest wrote: Show quoted text
> Bignums do not behave like normal numbers when modifying operations are > used. > > Consider: > sub foo($) { > my($num) = @_; $num /= 1000; > } > my $num = new Math::BigInt 12345; > foo($num); > print "This <$num> should be <12345>.\n"; > > In other words, replacing integers with bigint in one part of a program > can have serious consequences somewhere seemingly unrelated. > > The solution would be either to use CoW (preferred ;-) , or be able to > mark numbers as immutable, so that self-modifying operators throw an
error. On my system your example prints: This <12345> should be <12345>. Inside foo(), it prints 12. So this seems to be a non-issue !? In addition, it seems I already solved this problem, uh, like five years ago with Math::BigInt::Constant :-D Thanx for your report, I hope this issue is solved and I can close this bug. Best wishes, Tels
Since there was no reply I assume the issue is resolved.