summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2008-06-09 15:51:08 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2008-06-09 15:51:08 +0000
commit9d0ac285eba9bb3a0f58cdb654971a6e6e409b6d (patch)
treee7766c913e9728df2a29190b7d40fbb0b948635b /sal
parenta7496b997cb542080aeed7c36b23dec7ca613282 (diff)
INTEGRATION: CWS odff03 (1.6.380); FILE MERGED
2008/05/08 22:25:50 er 1.6.380.2: RESYNC: (1.6-1.7); FILE MERGED 2008/05/08 14:15:16 er 1.6.380.1: #i86775# added approxValue() wrapper around rtl_math_approxValue(); changed approxFloor()/approxCeil() to use approxValue() instead of the approxEqual() clumsiness
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/math.hxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/sal/inc/rtl/math.hxx b/sal/inc/rtl/math.hxx
index e46fd0702697..5161294ad8b5 100644
--- a/sal/inc/rtl/math.hxx
+++ b/sal/inc/rtl/math.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: math.hxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
* This file is part of OpenOffice.org.
*
@@ -193,6 +193,13 @@ inline double pow10Exp(double fValue, int nExp)
return rtl_math_pow10Exp(fValue, nExp);
}
+/** A wrapper around rtl_math_approxValue.
+ */
+inline double approxValue(double fValue)
+{
+ return rtl_math_approxValue(fValue);
+}
+
/** Test equality of two values with an accuracy of the magnitude of the
given values scaled by 2^-48 (4 bits roundoff stripped).
@@ -238,38 +245,22 @@ inline double approxSub(double a, double b)
return a - b;
}
-/** floor() method taking approxEqual() into account.
+/** floor() method taking approxValue() into account.
Use for expected integer values being calculated by double functions.
-
- @ATTENTION
- The threshhold value is 3.55271e-015
*/
inline double approxFloor(double a)
{
- double b = floor( a );
- // The second approxEqual() is necessary for values that are near the limit
- // of numbers representable with 4 bits stripped off. (#i12446#)
- if ( approxEqual( a - 1.0, b ) && !approxEqual( a, b ) )
- return b + 1.0;
- return b;
+ return floor( approxValue( a ));
}
-/** ceil() method taking approxEqual() into account.
+/** ceil() method taking approxValue() into account.
Use for expected integer values being calculated by double functions.
-
- @ATTENTION
- The threshhold value is 3.55271e-015
*/
inline double approxCeil(double a)
{
- double b = ceil( a );
- // The second approxEqual() is necessary for values that are near the limit
- // of numbers representable with 4 bits stripped off. (#i12446#)
- if ( approxEqual( a + 1.0, b ) && !approxEqual( a, b ) )
- return b - 1.0;
- return b;
+ return ceil( approxValue( a ));
}
/** Tests whether a value is neither INF nor NAN.