home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / Math::BigInt.z / Math::BigInt
Encoding:
Text File  |  1998-10-30  |  2.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))                                                MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Math::BigInt - Arbitrary size integer math package
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.        use Math::BigInt;
  13.        $i = Math::BigInt->new($string);
  14.  
  15.        $i->bneg return BINT               negation
  16.        $i->babs return BINT               absolute value
  17.        $i->bcmp(BINT) return CODE         compare numbers (undef,<0,=0,>0)
  18.        $i->badd(BINT) return BINT         addition
  19.        $i->bsub(BINT) return BINT         subtraction
  20.        $i->bmul(BINT) return BINT         multiplication
  21.        $i->bdiv(BINT) return (BINT,BINT)  division (quo,rem) just quo if scalar
  22.        $i->bmod(BINT) return BINT         modulus
  23.        $i->bgcd(BINT) return BINT         greatest common divisor
  24.        $i->bnorm return BINT              normalization
  25.  
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      All basic math operations are overloaded if you declare your big integers
  29.      as
  30.  
  31.        $i = new Math::BigInt '123 456 789 123 456 789';
  32.  
  33.  
  34.      Canonical notation
  35.        Big integer value are strings of the form /^[+-]\d+$/ with leading
  36.        zeros suppressed.
  37.  
  38.      Input
  39.        Input values to these routines may be strings of the form /^\s*[+-
  40.        ]?[\d\s]+$/.
  41.  
  42.      Output
  43.        Output values always always in canonical form
  44.  
  45.      Actual math is done in an internal format consisting of an array whose
  46.      first element is the sign (/^[+-]$/) and whose remaining elements are
  47.      base 100000 digits with the least significant digit first.  The string
  48.      'NaN' is used to represent the result when input arguments are not
  49.      numbers, as well as the result of dividing by zero.
  50.  
  51. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  52.         '+0'                            canonical zero value
  53.         '   -123 123 123'               canonical value '-123123123'
  54.         '1 23 456 7890'                 canonical value '+1234567890'
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))                                                MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))
  71.  
  72.  
  73.  
  74. BUGS
  75.      The current version of this module is a preliminary version of the real
  76.      thing that is currently (as of perl5.002) under development.
  77.  
  78. AAAAUUUUTTTTHHHHOOOORRRR
  79.      Mark Biggar, overloaded interface by Ilya Zakharevich.
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.