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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | tests/language/nan_identical_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "platform/math.h" 7 #include "platform/math.h"
8 8
9 #include "vm/code_generator.h" // DartModulo. 9 #include "vm/code_generator.h" // DartModulo.
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 295
296 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { 296 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) {
297 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); 297 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
298 // Include negative zero, infinity. 298 // Include negative zero, infinity.
299 double dval = arg.value(); 299 double dval = arg.value();
300 return Bool::Get(signbit(dval) && !isnan(dval)).raw(); 300 return Bool::Get(signbit(dval) && !isnan(dval)).raw();
301 } 301 }
302 302
303
304 DEFINE_NATIVE_ENTRY(Double_flipNANsign, 1) {
305 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
306 ASSERT(isnan(arg.value()));
307 double res;
308 if (signbit(arg.value()) == 1) {
309 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
310 } else {
311 res = -NAN;
312 }
313 return Double::New(res);
314 }
315
303 // Add here only functions using/referring to old-style casts. 316 // Add here only functions using/referring to old-style casts.
304 317
305 } // namespace dart 318 } // namespace dart
OLDNEW
« 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