summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-03-04 12:41:00 +0000
committerOliver Bolte <obo@openoffice.org>2009-03-04 12:41:00 +0000
commit8e90a4f14eb02b49abb19ece596e1d35db2d45fd (patch)
treea1b6b34a552947518d20527f46bb0c1b97f09632 /sal
parentb10a9b39e5161e5c5ef3f0a2b96e8f98a9d80e57 (diff)
CWS-TOOLING: integrate CWS calcperf03
2009-01-27 17:45:09 +0100 er r267014 : satisfy some stoneage compiler (tinderbox error) 2009-01-26 13:53:16 +0100 er r266921 : corrected merge accident 2009-01-23 23:27:18 +0100 er r266857 : #i97468# for better accuracy use ::rtl::math::atanh() in ATANH and FISHER, tanh() in FISHERINV; patch from <regina> 2009-01-23 23:08:14 +0100 er r266854 : #i97467# added C99 atanh() substitute rtl_math_atanh() and ::rtl::math::atanh() since not all compilers have it; patch from <regina> Plus in rtl_math_log1p() made a variable volatile to prevent compilers from being too smart. 2009-01-23 19:20:43 +0100 er r266849 : #i95381# make PODF adapter recognize empty/missing parameter, in this case ADDRESS 3rd parameter 2009-01-23 17:34:21 +0100 er r266841 : #i95450# support ADDRESS 3rd parameter (abs) as missing parameter 2009-01-23 15:53:23 +0100 er r266830 : some minor beautification 2009-01-23 15:45:20 +0100 er r266829 : small bits missed during integration of cws frmdlg 2009-01-23 02:56:38 +0100 er r266764 : removed CVS nonsense 2009-01-23 02:50:15 +0100 er r266763 : get rid of nasty DOS lineends 2009-01-23 01:56:09 +0100 er r266762 : #i98318# fix crash with external references constructed via Function Wizard; also fixes crash #i98338# and WaE #i97555# 2009-01-22 15:58:41 +0100 er r266732 : #i97547# EUROCONVERT: add SKK/EUR 2009-01-21 15:47:39 +0100 er r266676 : CWS-TOOLING: rebase CWS calcperf03 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 17:22:23 +0100 er r266105 : #i89976# use ::std::nth_element() instead of a fully sorted array for MEDIAN, PERCENTILE, QUARTILE, LARGE, SMALL 2008-11-07 20:13:55 +0100 er r263483 : #i95967# Broadcast: use bulk broadcast also for single cell changes as multiple identical listeners may be involved; speeds up the Zaske document to draw level with Excel 2008-11-07 20:08:37 +0100 er r263482 : #i95967# Notify: spare a vtable access
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/math.h10
-rw-r--r--sal/inc/rtl/math.hxx7
-rw-r--r--sal/rtl/source/math.cxx13
-rwxr-xr-xsal/util/sal.map1
4 files changed, 30 insertions, 1 deletions
diff --git a/sal/inc/rtl/math.h b/sal/inc/rtl/math.h
index 12cf825da464..4d72bcaa39d1 100644
--- a/sal/inc/rtl/math.h
+++ b/sal/inc/rtl/math.h
@@ -424,6 +424,16 @@ double SAL_CALL rtl_math_expm1(double fValue) SAL_THROW_EXTERN_C();
*/
double SAL_CALL rtl_math_log1p(double fValue) SAL_THROW_EXTERN_C();
+/** Returns more accurate atanh(x) for x near 0 than calculating
+ 0.5*log((1+x)/(1-x)).
+
+ atanh is part of the C99 standard, but not provided by some compilers.
+
+ @param fValue
+ The value x in the term atanh(x).
+ */
+double SAL_CALL rtl_math_atanh(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 7dd7282449f6..b61cf9b9806f 100644
--- a/sal/inc/rtl/math.hxx
+++ b/sal/inc/rtl/math.hxx
@@ -214,6 +214,13 @@ inline double log1p(double fValue)
return rtl_math_log1p(fValue);
}
+/** A wrapper around rtl_math_atanh.
+ */
+inline double atanh(double fValue)
+{
+ return rtl_math_atanh(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 c3b7147fb606..3f41d5a9c105 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -974,9 +974,20 @@ double SAL_CALL rtl_math_expm1( double fValue ) SAL_THROW_EXTERN_C()
double SAL_CALL rtl_math_log1p( double fValue ) SAL_THROW_EXTERN_C()
{
- double fp = 1.0 + fValue;
+ // Use volatile because a compiler may be too smart "optimizing" the
+ // condition such that in certain cases the else path was called even if
+ // (fp==1.0) was true, where the term (fp-1.0) then resulted in 0.0 and
+ // hence the entire expression resulted in NaN.
+ // Happened with g++ 3.4.1 and an input value of 9.87E-18
+ volatile double fp = 1.0 + fValue;
if (fp == 1.0)
return fValue;
else
return log(fp) * fValue / (fp-1.0);
}
+
+
+double SAL_CALL rtl_math_atanh( double fValue ) SAL_THROW_EXTERN_C()
+{
+ return 0.5 * rtl_math_log1p( 2.0 * fValue / (1.0-fValue) );
+}
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 6104625d1081..36576439c7f8 100755
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -579,6 +579,7 @@ UDK_3.9 { # OOo 3.1
global:
rtl_math_expm1;
rtl_math_log1p;
+ rtl_math_atanh;
} UDK_3.8;
PRIVATE_1.0 {