use Math::BigFloat; $f = Math::BigFloat->new($string); # NSTR is a number string; SCALE is an integer value. # In all following cases $f remains unchanged. # All methods except fcmp() return a number string. $f->fadd(NSTR); # return sum of NSTR and $f $f->fsub(NSTR); # return $f minus NSTR $f->fmul(NSTR); # return $f multiplied by NSTR $f->fdiv(NSTR[,SCALE]); # return $f divided by NSTR to SCALE places $f->fneg(); # return negative of $f $f->fabs(); # return absolute value of $f $f->fcmp(NSTR); # compare $f to NSTR; see below for return value $f->fround(SCALE); # return rounded value of $f to SCALE digits $f->ffround(SCALE); # return rounded value of $f at SCALEth place $f->fnorm(); # return normalization of $f $f->fsqrt([SCALE]); # return sqrt of $f to SCALE places ***** $float = new Math::BigFloat "2.123123123123123123123123123123123"; ***** $f = Math::BigFloat->new("-20.0 0732"); $g = $f->fmul("-20.00732"); ***** max($div_scale, length(dividend)+length(divisor)) ***** $f = Math::BigFloat->new("20.00732"); $g = Math::BigFloat->new("1.7"); ***** $h = -20.00732 * 1.7; # 34.012444 (ordinary math--$h is not an object) $h = $f * $g; # "34.012444" ($h is now a BigFloat object) $h = $f * 1.7; # "34.012444" ($h is now a BigFloat object) $h = -20.00732 * $g; # "34.012444" ($h is now a BigFloat object) $h = $f->fmul($g); # "+34012444E-6" ($h is now a BigFloat object) $h = $f->fmul(1.7); # "+34012444E-6" ($h is now a BigFloat object)