Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

# Number::WithError 0.08

Date Added: April 19, 2010  |  Visits: 568

Number::WithError is a Perl module that contains numbers with error propagation and scientific rounding. SYNOPSIS use Number::WithError; my \$num = Number::WithError->new(5.647, 0.31); print \$num . "n"; # prints 5.65e+00 +/- 3.1e-01 # (I.e. it automatically does scientific rounding) my \$another = \$num * 3; print \$another . "n"; # propagates the error assuming gaussian errors # prints 1.69e+01 +/- 9.3e-01 # trigonometric functions also work: print sin(\$another) . "n"; # prints -9.4e-01 +/- 3.1e-01 my \$third = \$another ** \$num; print \$third. "n"; # propagates both errors into one. # prints 8.7e+06 +/- 8.1e+06 # shortcut for the constructor: use Number::WithError witherror; \$num = witherror(0.00032678, [2.5e-5, 3e-5], 5e-6); # can deal with any number of errors, even with asymmetric errors print \$num . "n"; # prints 3.268e-04 + 2.5e-05 - 3.00e-05 +/- 5.0e-06 # Note: It may be annyoing that they dont all have the same # exponent, but they *do* all have the sam significant digit! This class is a container class for numbers with a number of associated symmetric and asymmetric errors. It overloads practically all common arithmetic operations and trigonometric functions to propagate the errors. It can do proper scientific rounding (as explained in more detail below in the documentation of the significant_digit() method). You can use Math::BigFloat objects as the internal representation of numbers in order to support arbitrary precision calculations. Errors are propagated using Gaussian error propagation. With a notable exception, the test suite covers way over ninety percent of the code. The remaining holes are mostly difficult-to-test corner cases and sanity tests. The comparison routines are the exception for which there will be more extensive tests in a future release..

 Requirements: No special requirements Platforms: Linux Keyword: Error,  Error Propagation,  Errors,  Libraries,  Num,  Numbers,  Numberwitherror,  Perl Module,  Prints,  Programming,  Scientific,  Witherror Users rating: 0/10