Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: maximum value of a scalar

by ccn (Vicar)
on Oct 21, 2008 at 09:17 UTC ( [id://718418]=note: print w/replies, xml ) Need Help??


in reply to maximum value of a scalar

ccn@laptop:~$ perl -MPOSIX -le 'print LONG_MAX' 2147483647 ccn@laptop:~$

Replies are listed 'Best First'.
Re^2: maximum value of a scalar
by Taulmarill (Deacon) on Oct 21, 2008 at 09:29 UTC
    If that's not enough, you can always use Modules like Math::BigInt to use integers as large as you want (or at least up to the size of your computers memory).
      you can always use Modules like Math::BigInt

      Excellent observation - and such large numbers are, after all, stored in scalars - as per the OP's requirement.

      The one limitation of Math::BigInt is that it's pure perl and can therefore be a little slow when it comes to manipulating those numeric values. As an alternative one could look at modules like Math::GMP, Math::Pari and Math::MPFR. These modules, like Math::BigInt, all store their values in sclarars and they still suffer from the "available memory" limitation - and, unlike Math::BigInt, they all depend upon external C libraries. The one big difference in their favour is that they provide much faster arithmetic manipulation of the bignum values than Math::BigInt.

      Cheers,
      Rob
Re^2: maximum value of a scalar
by JavaFan (Canon) on Oct 21, 2008 at 09:36 UTC
    That's wrong. LONG_MAX is a C constant, made available to you. It may say something about the maximum signed integer perl uses internally, but it's not the same maximum integer Perl can use. (Note the significant capitalization of the italic words).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-03-29 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found