Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^4: long integer to hexadecimal conversion

by kikuchiyo (Monk)
on Oct 01, 2009 at 12:58 UTC ( #798641=note: print w/replies, xml ) Need Help??

in reply to Re^3: long integer to hexadecimal conversion
in thread long integer to hexadecimal conversion


You'd only need my algorithm if you wanted to express the integer in a base other than 16 (or 8).

use bigint; my @digits=map chr,(0x30..0x39,0x41..0x5d); my $base = 22; my $n = 123456789123456; my $h; while($n > 0){ $h .= $digits[ $n % $base ]; $n /= $base; } print scalar reverse $h';
Result is 4E5G93GHBE8.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://798641]
[Corion]: My household somewhat becomes a Dell stronghold since I threw out HP for not wanting to scan documents because of an empty ink cartridge ;)
[1nickt]: Wow. I had heard about the chips on HP cartriddges but not that issue. I rejected HP's equivalent laptop becuase of build quality, very plasticky keyboard. And I believe HP is the champon of bloatware, too.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2017-03-27 13:23 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.