For this week’s resource post, see the page Stand-alone code for numerical computing. It points to small, self-contained bits of code for special functions (log gamma, erf, etc.) and for random number generation (normal, Poisson, gamma, etc.).

The code is available in Python, C++, and C# versions. It could easily be translated into other languages since it hardly uses any language-specific features.

I wrote these functions for projects where you don’t have a numerical library available or would like to minimize dependencies. If you have access to a numerical library, such as SciPy in Python, then by all means use it (although SciPy is missing some of the random number generators provided here). In C++ and especially C#, it’s harder to find some of this functionality.

**Last week**: Code Project articles

**Next week**: Clinical trial software

I found an elegant version of ExpM1 for C#, based on rearranging the hyperbolic sine, which System.Math provides:

More accurate than the naïve version in my testing, and I confirmed it handles all the special cases (+/-0, Nan, +/-Inf) correctly.

I put that code in the public domain. Do whatever you want with it, no strings attached. Use at your own risk.