summaryrefslogtreecommitdiff
path: root/sc/inc/math.hxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-08-14 00:53:33 +0200
committerEike Rathke <erack@redhat.com>2015-08-14 01:05:22 +0200
commit6eede78d4e75fdbec7e565ebb15f1ce9956734f0 (patch)
treeaeb8cf928bba2cb8ad7a136cfe791b7bea71dfc4 /sc/inc/math.hxx
parent1e7f551b92bca8f3d2f73b39dd428ac55f2a5567 (diff)
forget about the C++ Standard, use our own known goods
Android-ARM doesn't have std::copysign(), who knows what else will be non-functioning on whatever platform.. Change-Id: I40e80c26f2892007caa3729bd0dda2733e875613
Diffstat (limited to 'sc/inc/math.hxx')
-rw-r--r--sc/inc/math.hxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/sc/inc/math.hxx b/sc/inc/math.hxx
index d97cdf14dae3..2740d76665c1 100644
--- a/sc/inc/math.hxx
+++ b/sc/inc/math.hxx
@@ -49,12 +49,18 @@ inline double div( const double& fNumerator, const double& fDenominator )
*/
inline double divide( const double& fNumerator, const double& fDenominator )
{
- if (fDenominator == 0.0) {
- if (std::isfinite(fNumerator) && fNumerator != 0.0) {
- return std::copysign( std::numeric_limits<double>::infinity(), fNumerator);
- } else {
- return std::numeric_limits<double>::quiet_NaN();
+ if (fDenominator == 0.0)
+ {
+ double fVal;
+ if (rtl::math::isFinite( fNumerator) && fNumerator != 0.0)
+ {
+ rtl::math::setInf( &fVal, rtl::math::isSignBitSet( fNumerator));
}
+ else
+ {
+ rtl::math::setNan( &fVal);
+ }
+ return fVal;
}
return fNumerator / fDenominator;
}