use Math::BigInt; # or make it faster: install (optional) Math::BigInt::GMP # and always use (it will fall back to pure Perl if the # GMP library is not installed): use Math::BigInt lib => 'GMP'; my $str = '1234567890'; $x = Math::BigInt->new($str); # defaults to 0 $y = $x->copy(); # make a true copy $x->badd($y); # addition (add $y to $x) $x->bsub($y); # subtraction (subtract $y from $x) $x->bstr(); # convert to a normalized string $x->bsstr(); # normalized string in scientific no +tation $x->as_hex(); # as signed hexadecimal string with +prefixed 0x $x->as_bin(); # as signed binary string with prefi +xed 0b # etc.
-Mark
In reply to Re: Arithmetic on numbers bigger than 1<<31
by kvale
in thread Arithmetic on numbers bigger than 1<<31
by thor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |