Index: src/string-stream.cc |
diff --git a/src/string-stream.cc b/src/string-stream.cc |
index 196e5bb4a16fac72b43118de8f9f9c6f4754e78b..eae7bc6b1563296f178d3f31d96d7e3b81b22da6 100644 |
--- a/src/string-stream.cc |
+++ b/src/string-stream.cc |
@@ -129,9 +129,18 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) { |
} |
case 'f': case 'g': case 'G': case 'e': case 'E': { |
double value = current.data_.u_double_; |
- EmbeddedVector<char, 28> formatted; |
- SNPrintF(formatted, temp.start(), value); |
- Add(formatted.start()); |
+ int inf = std::isinf(value); |
+ if (inf == -1) { |
+ Add("-inf"); |
+ } else if (inf == 1) { |
+ Add("inf"); |
+ } else if (std::isnan(value)) { |
+ Add("nan"); |
+ } else { |
+ EmbeddedVector<char, 28> formatted; |
+ SNPrintF(formatted, temp.start(), value); |
+ Add(formatted.start()); |
+ } |
break; |
} |
case 'p': { |