Picomath is a collection of small math functions inspired by John D. Cook's Stand-alone code for numerical computing. It is not compiled into a library in the usual sense (that is, something you can link to). Rather, the functions are presented as standalone snippets of code.
The picomath library is in the public domain. Do whatever you want with it, no strings attached. Use at your own risk.
Picomath provides the following functions:
- Error function
- Phi (standard normal CDF)
- Phi inverse
- Log Gamma
- exp(x) - 1 (for small x)
The functions are implemented in the following languages:
- Python (2.x and 3.x)
The picomath library is organised into subdirectories, with each language in a subdirectory. Each function (or group of interrelated functions such as Gamma and Log Gamma) are implemented in one source file. Each source file is designed with minimal dependencies, so it can be included directly into a project as is, or copy and pasted into other code.
The test suite consists of two parts:
SConstructfile (for SCons, a command line build system) to build the test code as needed
- a Python
test.pydriver at the top level, and a corresponding
test.*for each language
To build the tests:
To run the tests:
$ python test.py
The expected output is:
The top level
test.py runs each language-specific
test.* in turn, communicating with the implementation using standard input and output.
A simple text-based protocol is used to execute functions and return results.