diff options
Diffstat (limited to 'sal/rtl/source/math.cxx')
-rw-r--r-- | sal/rtl/source/math.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx index fde2a16cb..6258f3faf 100644 --- a/sal/rtl/source/math.cxx +++ b/sal/rtl/source/math.cxx @@ -959,3 +959,24 @@ double SAL_CALL rtl_math_approxValue( double fValue ) SAL_THROW_EXTERN_C() return bSign ? -fValue : fValue; } + + +double SAL_CALL rtl_math_expm1( double fValue ) SAL_THROW_EXTERN_C() +{ + double fe = exp( fValue ); + if (fe == 1.0) + return fValue; + if (fe-1.0 == -1.0) + return -1.0; + return (fe-1.0) * fValue / log(fe); +} + + +double SAL_CALL rtl_math_log1p( double fValue ) SAL_THROW_EXTERN_C() +{ + double fp = 1.0 + fValue; + if (fp == 1.0) + return fValue; + else + return log(fp) * fValue / (fp-1.0); +} |