Source

double-conversion / src / ieee.h

The branch 'single' does not exist.
Diff from to

src/ieee.h

     }
   }
 
+  double PreviousDouble() const {
+    if (d64_ == (kInfinity | kSignMask)) return -Double::Infinity();
+    if (Sign() > 0 && Significand() == 0) {
+      return -0.0;
+    }
+    if (Sign() < 0) {
+      return Double(d64_ + 1).value();
+    } else {
+      return Double(d64_ - 1).value();
+    }
+  }
+
   int Exponent() const {
     if (IsDenormal()) return kDenormalExponent;
 
     *out_m_minus = m_minus;
   }
 
+  // Precondition: the value encoded by this Single must be greater or equal
+  // than +0.0.
+  DiyFp UpperBoundary() const {
+    ASSERT(Sign() > 0);
+    return DiyFp(Significand() * 2 + 1, Exponent() - 1);
+  }
+
   bool LowerBoundaryIsCloser() const {
     // The boundary is closer if the significand is of the form f == 2^p-1 then
     // the lower boundary is closer.