summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/math.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 96c5843dcfea..a450f7baa774 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1103,12 +1103,14 @@ double SAL_CALL rtl_math_round(double fValue, int nDecPlaces,
else
nExp = 0;
- int nIndex = 15 - nExp;
+ int nIndex;
- if ( nIndex > 15 )
+ if (nExp < 0)
nIndex = 15;
- else if ( nIndex <= 1 )
+ else if (nExp >= 14)
nIndex = 0;
+ else
+ nIndex = 15 - nExp;
fValue = floor(fValue + 0.5 + nKorrVal[nIndex]);
}