Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Converting Hexadecimal to Decimal notation and vice-versa

by Not_a_Number (Prior)
on Oct 17, 2009 at 18:03 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://801775]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found