Index: src/double.h |
diff --git a/src/double.h b/src/double.h |
index 9db8ea7c48b0339b5dab21a1a69cf991612b9efb..54b83ecd5daf0c7371976d14340d3821945ab7c5 100644 |
--- a/src/double.h |
+++ b/src/double.h |
@@ -83,8 +83,16 @@ class Double { |
} |
double NextDouble() const { |
- if (d64_ == kInfinity) return kInfinity; |
- return Double(d64_ + 1).value(); |
+ if (d64_ == kInfinity) return Double(kInfinity).value(); |
+ if (Sign() < 0 && Significand() == 0) { |
+ // -0.0 |
+ return 0.0; |
+ } |
+ if (Sign() < 0) { |
+ return Double(d64_ - 1).value(); |
+ } else { |
+ return Double(d64_ + 1).value(); |
+ } |
} |
int Exponent() const { |