Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Convert big number from decimal to hexadecimalby ambrus (Abbot) |
on Jul 13, 2010 at 13:34 UTC ( [id://849259]=CUFP: print w/replies, xml ) | Need Help?? |
Today, deMize asked in the chatterbox how to convert the number 4335043554366887798866555766 to hexadecimal. One solution is of course to use dc:
The easiest perl solution is probably to use the Math::BigInt module:
But here's another, more complicated solution.
Update: deleted the unnecessary sub from the code. Update 2011-03-18: see also Re: Module for 128-bit integer math? for a list of bigint modules. Update 2012-08-25: see also Re: Zeckendorf representation for another conversion, this time to a more unusual number system.
Back to
Cool Uses for Perl
|
|