From 0421beabd33d135e1ab5f4a5a57eea836a93549b Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Tue, 6 Jan 2009 13:57:48 +0000
Subject: CWS-TOOLING: integrate CWS odff05 2008-12-11 04:17:37 +0100 er
r265237 : #i94555# AppendIntToken for GAMMADIST, Excel needs 4 parameters;
also use AppendIntToken instead of AppendNumToken for POISSON 2008-12-11
04:04:27 +0100 er r265236 : #i96837# make cumulative parameter of POISSON
optional; patch from with slight modifications 2008-12-11 03:35:03
+0100 er r265235 : #i96835# make base parameter of LOG() optional also in
UI; patch from 2008-12-11 03:15:30 +0100 er r265234 : #i94555# patch
from , ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative'
parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow
negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST
and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST
to PODF and ODFF if omitted, for backwards compatibility. 2008-12-10 18:14:16
+0100 er r265214 : DBG_... need semicolon 2008-12-05 00:49:55 +0100 er
r264881 : WaE unxlngi6: declaration of 'pFuncInfo' shadows a previous local
2008-12-05 00:26:05 +0100 er r264879 : #i91547# BETADIST with optional
density/cumulative parameter and much better precision; patch from
2008-12-04 22:51:40 +0100 er r264877 : #i91602# add expm1() and log1p()
replacements; based on a patch from 2008-12-01 16:07:35 +0100 dr
r264614 : #i93789# import of EUROCONVERT from XLSX/XLSB 2008-11-28 13:15:01
+0100 dr r264543 : #i93789# new sheet function EUROCONVERT + XLS
import/export, patch contributed by lvyue 2008-11-26 14:54:23 +0100 er
r264397 : CWS-TOOLING: rebase CWS odff05 to trunk@264325 (milestone:
DEV300:m36) 2008-11-20 14:23:33 +0100 er r264053 : CWS-TOOLING: rebase CWS
odff05 to trunk@263288 (milestone: DEV300:m35) 2008-11-19 18:07:43 +0100 er
r264012 : merged from trunk 2008-11-19 17:51:36 +0100 er r264011 : migrate
CWS odff05 to SVN
---
sal/inc/rtl/math.h | 18 ++++++++++++++++++
sal/inc/rtl/math.hxx | 14 ++++++++++++++
sal/rtl/source/math.cxx | 21 +++++++++++++++++++++
sal/util/sal.map | 6 ++++++
4 files changed, 59 insertions(+)
(limited to 'sal')
diff --git a/sal/inc/rtl/math.h b/sal/inc/rtl/math.h
index 96e2a02045b5..12cf825da464 100644
--- a/sal/inc/rtl/math.h
+++ b/sal/inc/rtl/math.h
@@ -406,6 +406,24 @@ double SAL_CALL rtl_math_pow10Exp(double fValue, int nExp) SAL_THROW_EXTERN_C();
*/
double SAL_CALL rtl_math_approxValue(double fValue) SAL_THROW_EXTERN_C();
+/** Returns more accurate e^x-1 for x near 0 than calculating directly.
+
+ expm1 is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term e^x-1.
+ */
+double SAL_CALL rtl_math_expm1(double fValue) SAL_THROW_EXTERN_C();
+
+/** Returns more accurate log(1+x) for x near 0 than calculating directly.
+
+ log1p is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term log(1+x).
+ */
+double SAL_CALL rtl_math_log1p(double fValue) SAL_THROW_EXTERN_C();
+
#if defined __cplusplus
}
#endif /* __cplusplus */
diff --git a/sal/inc/rtl/math.hxx b/sal/inc/rtl/math.hxx
index 5161294ad8b5..7dd7282449f6 100644
--- a/sal/inc/rtl/math.hxx
+++ b/sal/inc/rtl/math.hxx
@@ -200,6 +200,20 @@ inline double approxValue(double fValue)
return rtl_math_approxValue(fValue);
}
+/** A wrapper around rtl_math_expm1.
+ */
+inline double expm1(double fValue)
+{
+ return rtl_math_expm1(fValue);
+}
+
+/** A wrapper around rtl_math_log1p.
+ */
+inline double log1p(double fValue)
+{
+ return rtl_math_log1p(fValue);
+}
+
/** Test equality of two values with an accuracy of the magnitude of the
given values scaled by 2^-48 (4 bits roundoff stripped).
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index 91317d221ad5..c3b7147fb606 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);
+}
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 7173eac26bfa..6104625d1081 100755
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -575,6 +575,12 @@ UDK_3.8 { # OOo 3.0
rtl_math_approxValue;
} UDK_3.7;
+UDK_3.9 { # OOo 3.1
+ global:
+ rtl_math_expm1;
+ rtl_math_log1p;
+} UDK_3.8;
+
PRIVATE_1.0 {
global:
osl_detail_ObjectRegistry_storeAddresses;
--
cgit v1.2.3