[Libreoffice-commits] core.git: tools/qa tools/source
Stephan Bergmann
sbergman at redhat.com
Fri Oct 24 07:11:29 PDT 2014
tools/qa/cppunit/test_fract.cxx | 7 +++++++
tools/source/generic/fract.cxx | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 6a4b976bd0818c2f60b879594d393baad9a0f346
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 24 16:10:26 2014 +0200
Fix Fraction(-2147483648.0) for 32-bit wide long
Change-Id: I6465377de1edff5d0ccc0049fb6d24f6f1223fd2
diff --git a/tools/qa/cppunit/test_fract.cxx b/tools/qa/cppunit/test_fract.cxx
index bcc6ad2..febece0 100644
--- a/tools/qa/cppunit/test_fract.cxx
+++ b/tools/qa/cppunit/test_fract.cxx
@@ -90,8 +90,15 @@ public:
#endif
}
+ void testMinLongDouble() {
+ Fraction f(double(SAL_MIN_INT32));
+ CPPUNIT_ASSERT_EQUAL(long(SAL_MIN_INT32), f.GetNumerator());
+ CPPUNIT_ASSERT_EQUAL(1L, f.GetDenominator());
+ }
+
CPPUNIT_TEST_SUITE(FractionTest);
CPPUNIT_TEST(testFraction);
+ CPPUNIT_TEST(testMinLongDouble);
CPPUNIT_TEST_SUITE_END();
};
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 198a42a..7fee117 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -136,7 +136,7 @@ Fraction::Fraction( double dVal )
return;
}
- while ( std::abs( (long)dVal ) < nMAX && nDen < nMAX )
+ while ( std::abs( dVal ) < nMAX && nDen < nMAX )
{
dVal *= 10;
nDen *= 10;
More information about the Libreoffice-commits
mailing list