Math::BigFloat
Math::BigFloat(3pPerl Programmers Reference Math::BigFloat(t)



NAME
       Math::BigFloat - Arbitrary length float math package

SYNOPSIS
         use Math::BigFloat;
         $f = Math::BigFloat->new($string);

         $f->fadd(d) return NSTR            addition
         $f->fsub(b) return NSTR            subtraction
         $f->fmul(l) return NSTR            multiplication
         $f->fdiv(NSTR[,SCALE]) returns NSTR   division to SCALE places
         $f->fmod(d) returns NSTR           modular remainder
         $f->fneg() return NSTR                negation
         $f->fabs() return NSTR                absolute value
         $f->fcmp(p) return CODE            compare undef,<0,=0,>0
         $f->fround(d) return NSTR         round to SCALE digits
         $f->ffround(d) return NSTR        round at SCALEth place
         $f->fnorm() return (NSTR)             normalize
         $f->fsqrt([SCALE]) return NSTR        sqrt to SCALE places


DESCRIPTION
       All basic math operations are overloaded if you declare
       your big floats as

           $float = new Math::BigFloat "2.123123123123123123123123123123123";


       number format
         canonical strings have the form /[+-]\d+E[+-]\d+/ .
         Input values can have embedded whitespace.

       Error returns 'NaN'
         An input parameter was "Not a Number" or divide by zero
         or sqrt of negative number.

       Division is computed to
         "max($Math::BigFloat::div_scale,length(divi-
         dend)+length(h))" digits by default.  Also used
         for default sqrt scale.

       Rounding is performed
         according to the value of $Math::BigFloat::rnd_mode:

           trunc     truncate the value
           zero      round towards 0
           +inf      round towards +infinity (round up)
           -inf      round towards -infinity (round down)
           even      round to the nearest, .5 to the even digit
           odd       round to the nearest, .5 to the odd digit

         The default is "even" rounding.

BUGS
       The current version of this module is a preliminary ver-
       sion of the real thing that is currently (as of perl5.002)
       under development.

       The printf subroutine does not use the value of
       $Math::BigFloat::rnd_mode when rounding values for print-
       ing.  Consequently, the way to print rounded values is to
       specify the number of digits both as an argument to
       "ffround" and in the %f printf string, as follows:

         printf "%.3f\n", $bigfloat->ffround(-3);


AUTHOR
       Mark Biggar Patches by John Peacock Apr 2001 =cut



perl v5.6.1                 2001-02-23      Math::BigFloat(t)