Unless my headache is impacting my ability to manipulate log identities, this LOG10 code is plain wrong:
static double findLog(double value, FunctionType logFunction) { switch (logFunction) { case LN: return log(double(value)); case LOG10: return log(double(value)) / log(2.0); ... }
Perhaps it is dead code, since this divide should be log(10.0) (or just M_LN10), but nobody appears to have noticed.
Two other possibilities are:
- somebody was being way too clever, and when they wrote LOG10, they meant it as Log base 0b10.
- somebody thought that for computer software a “natural logarithm” would use base 2.