diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Support/APFloat.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
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 deb76cb565d1e..f7fb0cef16bf4 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,  | 
