diff options
Diffstat (limited to 'include/basegfx')
-rw-r--r-- | include/basegfx/numeric/ftools.hxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index 19d8d1722aff..19e8e101987c 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -59,11 +59,11 @@ namespace basegfx */ inline sal_Int32 fround( double fVal ) { - if (fVal >= std::numeric_limits<sal_Int32>::max()) + if (fVal >= std::numeric_limits<sal_Int32>::max() - .5) return std::numeric_limits<sal_Int32>::max(); - else if (fVal <= std::numeric_limits<sal_Int32>::min()) + else if (fVal <= std::numeric_limits<sal_Int32>::min() + .5) return std::numeric_limits<sal_Int32>::min(); - return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 ); + return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : static_cast<sal_Int32>( fVal - .5 ); } /** Round double to nearest integer |