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

Re: to convert 16 dig hex to dec

by haoess (Curate)
on Sep 01, 2005 at 10:15 UTC ( #488338=note: print w/ replies, xml ) Need Help??


in reply to to convert 16 dig hex to dec

print hex $value;

Update: Nevermind this throws a warning:

Integer overflow in hexadecimal number

A way without warnings:

perl -Mbigint -wle 'print 0x9DBE062CB1F34287'

Please, please have a look at the documentation search engine.

-- Frank


Comment on Re: to convert 16 dig hex to dec
Select or Download Code
Re^2: to convert 16 dig hex to dec
by Anonymous Monk on Sep 01, 2005 at 10:39 UTC
    I am getting an overflow error Integer overflow in hexadecimal number at hextodec.pl line 8. This is the output 1.13665292985635e+019 I need the output as not in exponential notation but string and I have tried
    $dec = hex $hex; printf "%s", $dec;
Re^2: to convert 16 dig hex to dec
by QM (Vicar) on Sep 01, 2005 at 15:41 UTC
    perl -Mbigint -wle 'print 0x9DBE062CB1F34287'
    Shouldn't that be:
    perl -MMath::Bigint -wle 'print 0x9DBE062CB1F34287'
    or is there some new namespace I'm not aware of?

    Update: I didn't look carefully enough. And I was cross-pollinated with:

    perl -MMath::Bigint -wle 'print Math::BigInt->new(q/0x9DBE062CB1F34287 +/)'

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Try it.

      And read "perldoc bigint"
        Of course! Curse my narrow-minded field of view.

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://488338]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2014-09-23 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (219 votes), past polls