OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |