Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Problems? Is your data what you think it is?
 
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 browsing the Monastery: (5)
As of 2014-04-21 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls