in reply to Add 1 to an arbitrary-length binary string
Cheers,use strict; use warnings; use Math::BigInt; my $string = '12349' x 10; my $x = Math::BigInt->new($string); print $x, "\n"; # $x is a Math::BigInt object $x++; print "$x", "\n"; # "$x" is a string __END__ Outputs: 12349123491234912349123491234912349123491234912349 12349123491234912349123491234912349123491234912350
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add 1 to an arbitrary-length binary string
by einhverfr (Friar) on Nov 15, 2023 at 12:23 UTC | |
by syphilis (Archbishop) on Nov 15, 2023 at 13:27 UTC | |
by einhverfr (Friar) on Nov 16, 2023 at 02:28 UTC | |
by Anonymous Monk on Nov 15, 2023 at 13:31 UTC |