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

Unified Diff: runtime/lib/double.cc

Issue 1160453003: Fix 23563: double unary- operator unstable for NANs (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: g Created 5 years, 7 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 | « no previous file | runtime/lib/double.dart » ('j') | tests/language/nan_identical_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/double.cc
diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc
index 4173c1403d034ad917f12dea13d7f23cd2fc1f4b..6771bfa2b229f0a19bceaed46b176d8dde6f5145 100644
--- a/runtime/lib/double.cc
+++ b/runtime/lib/double.cc
@@ -300,6 +300,19 @@ DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) {
return Bool::Get(signbit(dval) && !isnan(dval)).raw();
}
+
+DEFINE_NATIVE_ENTRY(Double_flipNANsign, 1) {
+ const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
+ ASSERT(isnan(arg.value()));
+ double res;
+ if (signbit(arg.value()) == 1) {
+ res = NAN;
koda 2015/06/02 21:20:57 Here, you are also normalizing to a particular NAN
srdjan 2015/06/02 22:32:10 Renamed method to Double_flipSignBit. Flipping sig
+ } else {
+ res = -NAN;
+ }
+ return Double::New(res);
+}
+
// Add here only functions using/referring to old-style casts.
} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | tests/language/nan_identical_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698