NAME Math::Erf::Approx - pure Perl approximate implementation of the error function DESCRIPTION This is a pure Perl implementation of the error function (a.k.a. the Gauss error function). It gives an approximation with a maximum absolute difference of 0.0005 from the real value. Functions This module can export two functions. Neither is exported by default. This module uses Sub::Exporter, so the functions can be renamed: use Math::Erf::Approx -all => { -prefix => 'math_' }; "erf($x)" Calculates the result of the error function for value $x. "erfc($x, \&erf)" Given a value $x and a code reference to an implementation of erf(), calculates the complement. If the code reference is ommitted (which I'd expect would be the most usual case), then the default is the "erf" function provided by this module. Testing It is possible to run a small test suite on this module using: use Math::Erf::Approx; Math::Erf::Approx->run_tests; BENCHMARKS Benchmarking against Games::Go::Erf (on a fairly underpowered netbook)... Benchmark: timing 100000 iterations of GGE, MEA... GGE: 6 wallclock secs ( 6.34 usr + 0.01 sys = 6.35 CPU) @ 15748.03/s (n=100000) MEA: 3 wallclock secs ( 2.71 usr + 0.00 sys = 2.71 CPU) @ 36900.37/s (n=100000) There are considerations other than raw speed though... * Games::Go::Erf provides much more accurate results * ... and it can calculate inverses * ... but it has a dependency on Tk * ... and it sets $[ to 1, which has been deprecated since Perl 5.12. SEE ALSO . *Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables*, ed Milton Abramowitz and Irene Stegun. ISBN 0-486-61272-4. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2012 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.