Math::GMPf

Perl interface to the GMP library's floating point (mpf) functions
Download

Math::GMPf Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sisyphus
  • Publisher web site:
  • http://search.cpan.org/~sisyphus/

Math::GMPf Tags


Math::GMPf Description

Perl interface to the GMP library's floating point (mpf) functions Math::GMPf is a bigfloat module utilising the Gnu MP (GMP) library. Basically this module simply wraps all of the 'mpf' floating point functions provided by that library. The documentation below extensively plagiarises the GMP documentation at http://gmplib.org . See the Math::GMPf test suite for some examples of usage.SYNOPSIS use Math::GMPf qw(:mpf); my $string = '.123542@2'; # mantissa = (.)12345 # exponent = 2 # my $string = '12.354'; # alternative string format my $base = 10; # Set the default precision to at least 80 bits. Rmpf_set_default_prec(80); # Create the Math::GMPf object my $bn1 = Rmpf_init_set_str($string, $base); # Create another Math::GMPf object that holds # an initial value of zero, but with at least # 131 bits of precision. my $bn2 = Rmpf_init2(131); # Create another Math::GMPf object that holds # an initial value of zero, with default precision. my $bn3 = Rmpf_init(); # Or just use the new() function: my $bn4 = Math::GMPf->new(116.8129); # Perform some operations ... see 'FUNCTIONS' below. . . # print out the value held by $bn1 (in octal): print Rmpf_get_str($bn1, 8, 0), " "; # print out the value held by $bn1 (in decimal): print Rmpf_get_str($bn1, 10, 0); # print out the value held by $bn1 (in base 29) # using the (alternative) TRmpf_out_str() # function. (This function doesn't print a newline.) TRmpf_out_str(*STDOUT, 29, 0, $bn1); Requirements: · Perl


Math::GMPf Related Software