diff options
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r-- | lib/Support/APFloat.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index deb76cb565d1..f7fb0cef16bf 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -1743,6 +1743,7 @@ IEEEFloat::opStatus IEEEFloat::remainder(const IEEEFloat &rhs) { IEEEFloat::opStatus IEEEFloat::mod(const IEEEFloat &rhs) { opStatus fs; fs = modSpecials(rhs); + unsigned int origSign = sign; while (isFiniteNonZero() && rhs.isFiniteNonZero() && compareAbsoluteValue(rhs) != cmpLessThan) { @@ -1754,6 +1755,8 @@ IEEEFloat::opStatus IEEEFloat::mod(const IEEEFloat &rhs) { fs = subtract(V, rmNearestTiesToEven); assert(fs==opOK); } + if (isZero()) + sign = origSign; // fmod requires this return fs; } @@ -4363,10 +4366,7 @@ bool DoubleAPFloat::isLargest() const { bool DoubleAPFloat::isInteger() const { assert(Semantics == &semPPCDoubleDouble && "Unexpected Semantics"); - APFloat Tmp(semPPCDoubleDoubleLegacy); - (void)Tmp.add(Floats[0], rmNearestTiesToEven); - (void)Tmp.add(Floats[1], rmNearestTiesToEven); - return Tmp.isInteger(); + return Floats[0].isInteger() && Floats[1].isInteger(); } void DoubleAPFloat::toString(SmallVectorImpl<char> &Str, |