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
commitaed8b0818a7d85d69b48f17c481c527a7c87ac07 (patch)
treeedbd6410cf2721e054cb5c134a99a081904136d3 /sal
parent42d9df3464a7464fe40c3701d290176db4ce7186 (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 15220906a..c93e7de4e 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.