You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2015/03/26 23:06:29 UTC

svn commit: r1669456 - in /openoffice/trunk/main/sal: inc/rtl/math.h inc/rtl/math.hxx rtl/source/math.cxx util/sal.map

Author: pfg
Date: Thu Mar 26 22:06:29 2015
New Revision: 1669456

URL: http://svn.apache.org/r1669456
Log:
Bring to SAL a wrapper implementation of the powr() IEEE 754 math function.

This function was originally brought in r1444110 and is useful for
OOXML compatibility. At this time it is not being used to fix the
original issue it was meant to address but it is convenient for
future use.

It also reduces the differences from FreeBSD's port which will
be receiving updates.


Modified:
    openoffice/trunk/main/sal/inc/rtl/math.h
    openoffice/trunk/main/sal/inc/rtl/math.hxx
    openoffice/trunk/main/sal/rtl/source/math.cxx
    openoffice/trunk/main/sal/util/sal.map

Modified: openoffice/trunk/main/sal/inc/rtl/math.h
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/inc/rtl/math.h?rev=1669456&r1=1669455&r2=1669456&view=diff
==============================================================================
--- openoffice/trunk/main/sal/inc/rtl/math.h (original)
+++ openoffice/trunk/main/sal/inc/rtl/math.h Thu Mar 26 22:06:29 2015
@@ -396,6 +396,21 @@ double SAL_CALL rtl_math_round(double fV
  */
 double SAL_CALL rtl_math_pow10Exp(double fValue, int nExp) SAL_THROW_EXTERN_C();
 
+/** Similar to pow() with stricter exception handling for indeterminate values.
+
+    powr is specified in the IEEE 754 - 2008 Floating Point Standard.
+
+    @param fValue
+    The value to be raised.
+
+    @param fExp
+    The exponent.
+
+    @return
+    powr(fValue, fExp)
+ */
+double SAL_CALL rtl_math_powr(double fValue, double fExp) SAL_THROW_EXTERN_C();
+
 /** Rounds value to 15 significant decimal digits.
 
     @param fValue

Modified: openoffice/trunk/main/sal/inc/rtl/math.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/inc/rtl/math.hxx?rev=1669456&r1=1669455&r2=1669456&view=diff
==============================================================================
--- openoffice/trunk/main/sal/inc/rtl/math.hxx (original)
+++ openoffice/trunk/main/sal/inc/rtl/math.hxx Thu Mar 26 22:06:29 2015
@@ -186,6 +186,13 @@ inline double pow10Exp(double fValue, in
     return rtl_math_pow10Exp(fValue, nExp);
 }
 
+/** A wrapper around rtl_math_powr.
+ */
+inline double powr(double fValue, double fExp)
+{
+    return rtl_math_powr(fValue, fExp);
+}
+
 /** A wrapper around rtl_math_approxValue.
  */
 inline double approxValue(double fValue)

Modified: openoffice/trunk/main/sal/rtl/source/math.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/rtl/source/math.cxx?rev=1669456&r1=1669455&r2=1669456&view=diff
==============================================================================
--- openoffice/trunk/main/sal/rtl/source/math.cxx (original)
+++ openoffice/trunk/main/sal/rtl/source/math.cxx Thu Mar 26 22:06:29 2015
@@ -1113,6 +1113,19 @@ double SAL_CALL rtl_math_expm1( double f
     return (fe-1.0) * fValue / log(fe);
 }
 
+double SAL_CALL rtl_math_powr( double fValue,  double fExp ) SAL_THROW_EXTERN_C()
+{
+    if ((fValue == 0.0  && fExp == 0.0) ||
+	(rtl::math::isInf( fExp ) && !rtl::math::isSignBitSet( fExp )) ||
+	(rtl::math::isInf( fValue ) && !rtl::math::isSignBitSet( fValue )))
+    {
+        double fResult;
+        ::rtl::math::setNan( &fResult );
+        return fResult;
+    }
+    return pow(fValue, fExp);
+}
+
 
 double SAL_CALL rtl_math_log1p( double fValue ) SAL_THROW_EXTERN_C()
 {

Modified: openoffice/trunk/main/sal/util/sal.map
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/util/sal.map?rev=1669456&r1=1669455&r2=1669456&view=diff
==============================================================================
--- openoffice/trunk/main/sal/util/sal.map (original)
+++ openoffice/trunk/main/sal/util/sal.map Thu Mar 26 22:06:29 2015
@@ -629,6 +629,8 @@ UDK_3.12 { # AOO 3.5
     global:
         osl_loadAsciiModule;
         osl_loadAsciiModuleRelative;
+
+        rtl_math_powr;
 } UDK_3.11;
 
 PRIVATE_1.0 {