in reply to big integers forcing me to be a C programmer: "range iterator outside integer range"
The C-style loop works with both bignum and Math::BigInt because it makes use of operators that are overloaded. Unfortunately, the '..' operator is not currently overloaded, and that's why the second loop fails.use warnings; use strict; use feature 'say'; use Math::BigInt; my $x = Math::BigInt->new(1); $x <<= 1024; for(my $i = $x; $i <= $x + 2; $i++) { say $i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: big integers forcing me to be a C programmer: "range iterator outside integer range"
by ikegami (Patriarch) on May 07, 2009 at 11:20 UTC | |
by syphilis (Archbishop) on May 07, 2009 at 11:30 UTC | |
by ikegami (Patriarch) on May 07, 2009 at 16:18 UTC |