Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

My numbers are rounded down...

by Anonymous Monk
on Jun 08, 2002 at 14:31 UTC ( [id://172779]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to do some mathematical operations, but my numbers are mistreated.

For example:.
123 ** 17 should be: 337587917446653715596592958817679803

But in PERL it isn't. So, how do I approach this. Maybe with Math:BigInt? But, it doesn't seem to work (I get NaN (not a number) stuff). I need detailed instructions, since I'm a dummy and all.

Replies are listed 'Best First'.
Re: My numbers are rounded down...
by Dog and Pony (Priest) on Jun 08, 2002 at 14:36 UTC
    Looking at the docs of Math::BigInt, this should do it:
    perl -MMath::BigInt=:constant -e "print 123**17"
    Which is the same thing as:
    use Math::BigInt ':constant'; print 123**17;
    Hope that helps. :)
    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
Re: My numbers are rounded down...
by crazyinsomniac (Prior) on Jun 09, 2002 at 00:23 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://172779]
Approved by Dog and Pony
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found