Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

perlman:Math::BigFloat

by root (Scribe)
on Dec 23, 1999 at 01:30 UTC ( #1284=perlfunc: print w/replies, xml ) Need Help??

Math::BigFloat

See the current Perl documentation for Math::BigFloat.

Here is our local, out-dated (pre-5.6) version:


Math::BigFloat - Arbitrary length float math package



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

  $f->fadd(NSTR) return NSTR            addition
  $f->fsub(NSTR) return NSTR            subtraction
  $f->fmul(NSTR) return NSTR            multiplication

    

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 inbedded 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($div_scale,length(dividend)+length(divisor)) digits by default. Also used for default sqrt scale.


BUGS

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


AUTHOR

Mark Biggar


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Lady_Aleena]: What?! Can't stat ~/Music: No such file or directory? The ~/ doesn't expand?
[Lady_Aleena]: And the env variable $HOME doesn't work either. !@#$
[shmem]: no, that's a shell feature. Use $ENV{HOME}
[marioroy]: my $ans = qx{ find \$HOME -name "*.pl" -exec ls -l {} \\; };
[marioroy]: must backslash $ inside qx
[Lady_Aleena]: I haven't written perl for a while, I've been trying to do things at the command line. I'm having to relearn a lot.
[marioroy]: LA can you post the qx find again
[Lady_Aleena]: Things I would have written a script for while I was on Windows, I can run simply on the command line.
[Lady_Aleena]: marioroy, my @music_times = qx(find ~/Music/Albums/ -type f -iname '*.mp3' -exec mp3info -p "%S\n" {} \;); #unfixed

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2017-04-23 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.