in reply to Re^2: Incrementing a large number without Math::BigInt
in thread Incrementing a large number without Math::BigInt
You may be interested that:
use strict; use warnings; my $i = 100000000; my $num = '9' x $i; $num++; print length ($num) . ' ' . substr $num, 0, 10;
Prints:
100000001 1000000000
and executes in about 1 second.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Incrementing a large number without Math::BigInt
by Cap'n Steve (Friar) on Apr 26, 2006 at 03:44 UTC | |
by GrandFather (Saint) on Apr 26, 2006 at 03:51 UTC | |
by ikegami (Patriarch) on Apr 26, 2006 at 05:17 UTC | |
by Cap'n Steve (Friar) on Apr 26, 2006 at 05:45 UTC | |
by ikegami (Patriarch) on Apr 26, 2006 at 06:33 UTC |