Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1825)

Unified Diff: src/string-stream.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scopes.cc ('k') | src/types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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': {
« no previous file with comments | « src/scopes.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698