Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Converting Hexadecimal to Decimal notation and vice-versa

by Not_a_Number (Parson)
on Oct 17, 2009 at 18:03 UTC ( #801775=note: print w/ replies, xml ) Need Help??


in reply to Converting Hexadecimal to Decimal notation and vice-versa

It works for me (once I've fixed the errors in your posted code):

use strict; use warnings; use Math::BigInt; # Missing from your posted code my $x_dec = Math::BigInt->from_hex("0x000102030405060708090a0b0c0d0e0f +"); print $x_dec, "\n"; # Not $x, as in your posted code # Output: 5233100606242806050955395731361295


Comment on Re: Converting Hexadecimal to Decimal notation and vice-versa
Download Code
Re^2: Converting Hexadecimal to Decimal notation and vice-versa
by Anonymous Monk on Oct 17, 2009 at 18:34 UTC
    Hi, thanks.
    We had an older version of Math::BigInt and that is why it seems it could not locate method from_hex.
    How do I convert a huge integer to hexadecimal using Math::BigInt?
      How do I convert a huge integer to hexadecimal

      ->as_hex()

        Hi,
        I tried the following and I got 'NaN' as the result.
        #!/usr/bin/perl use strict; use warnings; package main; use Math::BigInt; my $gene_sample_101dcef = Math::BigInt->as_hex("5555181933400000000066 +6"); print $gene_sample_101dcef,"\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-07-03 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls