Monday, January 25, 2010

Logarithm to any base in ruby

Ruby's Math module includes functions for a natural log (log to the base e) and the common log (log to the base 10). If you have to have a log to an arbitrary base, you have to write your own. Doing so is trivial.



I will probably explain the theory behind this another day.