Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Math With Big Numbers

by pryrt (Abbot)
on Feb 14, 2019 at 21:02 UTC ( [id://1229920]=note: print w/replies, xml ) Need Help??


in reply to Math With Big Numbers

C:\>perl -MMath::BigInt -le "push @ans, 6**25; push @ans, Math::BigInt +->new(6)**25; push @ans, 6**Math::BigInt->new(25); push @ans, Math::B +igInt->new(6)**Math::BigInt->new(25); print for @ans" 2.84302880299297e+019 28430288029929701376 28430288029929701376 28430288029929701376

As ++tybalt89 pointed out, you need to convert before you do the exponentiation. But you don't actually have to convert both -- you can convert either the base or the exponent or both, and the BigInt math will work correctly

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found