| 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 <math.h> | 5 #include <math.h> | 
| 6 | 6 | 
| 7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" | 
| 8 | 8 | 
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" | 
| 10 #include "vm/double_conversion.h" | 10 #include "vm/double_conversion.h" | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 80     OS::Print("Double_trunc_div %f ~/ %f\n", left, right); | 80     OS::Print("Double_trunc_div %f ~/ %f\n", left, right); | 
| 81   } | 81   } | 
| 82   return Double::New(trunc(left / right)); | 82   return Double::New(trunc(left / right)); | 
| 83 } | 83 } | 
| 84 | 84 | 
| 85 | 85 | 
| 86 DEFINE_NATIVE_ENTRY(Double_modulo, 2) { | 86 DEFINE_NATIVE_ENTRY(Double_modulo, 2) { | 
| 87   double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); | 87   double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); | 
| 88   GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); | 88   GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); | 
| 89   double right = right_object.value(); | 89   double right = right_object.value(); | 
| 90   double remainder = fmod(left, right); | 90 | 
|  | 91   double remainder = fmod_ieee(left, right); | 
| 91   if (remainder == 0.0) { | 92   if (remainder == 0.0) { | 
| 92     // We explicitely switch to the positive 0.0 (just in case it was negative). | 93     // We explicitely switch to the positive 0.0 (just in case it was negative). | 
| 93     remainder = +0.0; | 94     remainder = +0.0; | 
| 94   } else if (remainder < 0) { | 95   } else if (remainder < 0) { | 
| 95     if (right < 0) { | 96     if (right < 0) { | 
| 96       remainder -= right; | 97       remainder -= right; | 
| 97     } else { | 98     } else { | 
| 98       remainder += right; | 99       remainder += right; | 
| 99     } | 100     } | 
| 100   } | 101   } | 
| 101   return Double::New(remainder); | 102   return Double::New(remainder); | 
| 102 } | 103 } | 
| 103 | 104 | 
| 104 | 105 | 
| 105 DEFINE_NATIVE_ENTRY(Double_remainder, 2) { | 106 DEFINE_NATIVE_ENTRY(Double_remainder, 2) { | 
| 106   double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); | 107   double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value(); | 
| 107   GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); | 108   GET_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); | 
| 108   double right = right_object.value(); | 109   double right = right_object.value(); | 
| 109   return Double::New(fmod(left, right)); | 110   return Double::New(fmod_ieee(left, right)); | 
| 110 } | 111 } | 
| 111 | 112 | 
| 112 | 113 | 
| 113 DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { | 114 DEFINE_NATIVE_ENTRY(Double_greaterThan, 2) { | 
| 114   const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); | 115   const Double& left = Double::CheckedHandle(arguments->NativeArgAt(0)); | 
| 115   GET_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); | 116   GET_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1)); | 
| 116   bool result = right.IsNull() ? false : (left.value() > right.value()); | 117   bool result = right.IsNull() ? false : (left.value() > right.value()); | 
| 117   if (FLAG_trace_intrinsified_natives) { | 118   if (FLAG_trace_intrinsified_natives) { | 
| 118     OS::Print("Double_greaterThan %s > %s\n", | 119     OS::Print("Double_greaterThan %s > %s\n", | 
| 119         left.ToCString(), right.ToCString()); | 120         left.ToCString(), right.ToCString()); | 
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 329 | 330 | 
| 330 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { | 331 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { | 
| 331   const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 332   const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 
| 332   // Include negative zero, infinity. | 333   // Include negative zero, infinity. | 
| 333   return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); | 334   return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); | 
| 334 } | 335 } | 
| 335 | 336 | 
| 336 // Add here only functions using/referring to old-style casts. | 337 // Add here only functions using/referring to old-style casts. | 
| 337 | 338 | 
| 338 }  // namespace dart | 339 }  // namespace dart | 
| OLD | NEW | 
|---|