Math::Decimal64Perl interface to C's _Decimal64 operations | |
Download |
Math::Decimal64 Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Sisyphus
- Publisher web site:
- http://search.cpan.org/~sisyphus/
Math::Decimal64 Tags
Math::Decimal64 Description
Math::Decimal64 is a Perl module that supports up to 16 decimal digits of significand (mantissa) and an exponent range of -383 to +384. The smallest expressable value is -9.999999999999999e384 (which is also equivalent to -9999999999999999e369). The largest expressable value is 9.999999999999999e384 (which also equivalent to 9999999999999999e369). The closest we can get to zero is (plus or minus) 1e-384 (which is also equivalent to 1000000000000000e-399).This module allows decimal floating point arithmetic via operator overloading - see "OVERLOADING".In the documentation that follows, "$mantissa" is a perl scalar holding a string of up to 16 decimal digits: $mantissa = '1234'; $mantissa = '1234567890123456';For many values, it normally shouldn't matter if $mantissa is assigned as a number: $mantissa = 1234; # should work ok.But on some perls there are values that *need* to be assigned as a string. For example, on perls where nvtype is an 8 byte 'double': $mantissa = '-9307199254740993'; # works fine $mantissa = -9307199254740993; # will assign wrong value.So ... where you see "$mantissa" in the following docs, think *string* of up to 16 decimal digits".SYNOPSIS use Math::Decimal64 qw(:all); my $d64_1 = MEtoD64('9927', -2); # the decimal 99.27 my $d64_2 = MEtoD64('3', 0); # the decimal 3.0 $d64_1 /= $d64_2; print $d64_1; # prints 3309e-2 (33.09)Product's homepage
Math::Decimal64 Related Software