--- math.hxx.original 2008-11-21 23:35:59.859375000 +0100 +++ math.hxx 2008-12-01 15:35:41.203125000 +0100 @@ -367,6 +367,29 @@ return d; } +/** The MSVC compilers do not provide expm1 and log1p. The following functions + are an ersatz for them. +*/ + +inline double expm1(double x) +{ + double u = exp(x); + if (u == 1.0) + return x; + if (u-1. == -1.0) + return -1.0; + return (u-1.0)*x/log(u); +} + +inline double log1p(double fX) +{ + double fU = 1.0+fX; + if (fU == 1.0) + return fX; + else + return log(fU)*fX/(fU-1.0); +} + } }