in reply to Big Numbers
Math::BigInt lets you define numbers as my $num = Math::BigInt->new( '18 446 744 073 709 551 617' ) which is as about as clean as it gets.
Internally, the package uses base 10 arithmetic, not base 2 (or 16), which is why I suspect you can't enter numbers in hex format. I suppose no-one has got around to patching the package to do it. Converting between base 10 and base 16 is algorithmically fairly trivial but computationally quite expensive, as you have to perform repeated divisions. (Update: to be precise, converting from hex to dec is easy. I was thinking about converting from decimal to hex... unless there's something I've missed, you can't do it with lookup tables).
Your easiest bet would be to write a program that takes an arbirtarily long hex string and converts it to base 10, and use that constant in your program. For extra credit, you could patch the Math::BigInt package to allow the 0x prefix to signify a hex representation, and have the package decode it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Big Numbers
by Abigail-II (Bishop) on Jul 22, 2002 at 14:24 UTC | |
|
Re: Re: Big Numbers
by RollyGuy (Chaplain) on Jul 22, 2002 at 15:32 UTC |