| 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/code_generator.h" // DartModulo. | 10 #include "vm/code_generator.h" // DartModulo. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return Double::New(ceil(arg.value())); | 165 return Double::New(ceil(arg.value())); |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { | 169 DEFINE_NATIVE_ENTRY(Double_truncate, 1) { |
| 170 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 170 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
| 171 return Double::New(trunc(arg.value())); | 171 return Double::New(trunc(arg.value())); |
| 172 } | 172 } |
| 173 | 173 |
| 174 | 174 |
| 175 DEFINE_NATIVE_ENTRY(Double_pow, 2) { | |
| 176 const double operand = | |
| 177 Double::CheckedHandle(arguments->NativeArgAt(0)).value(); | |
| 178 GET_NON_NULL_NATIVE_ARGUMENT( | |
| 179 Double, exponent_object, arguments->NativeArgAt(1)); | |
| 180 const double exponent = exponent_object.value(); | |
| 181 return Double::New(pow(operand, exponent)); | |
| 182 } | |
| 183 | |
| 184 | |
| 185 #if defined(TARGET_OS_MACOS) | 175 #if defined(TARGET_OS_MACOS) |
| 186 // MAC OSX math library produces old style cast warning. | 176 // MAC OSX math library produces old style cast warning. |
| 187 #pragma GCC diagnostic ignored "-Wold-style-cast" | 177 #pragma GCC diagnostic ignored "-Wold-style-cast" |
| 188 #endif | 178 #endif |
| 189 | 179 |
| 190 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { | 180 DEFINE_NATIVE_ENTRY(Double_toInt, 1) { |
| 191 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 181 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
| 192 return DoubleToInteger(arg.value(), "Infinity or NaN toInt"); | 182 return DoubleToInteger(arg.value(), "Infinity or NaN toInt"); |
| 193 } | 183 } |
| 194 | 184 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 277 |
| 288 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { | 278 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { |
| 289 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); | 279 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); |
| 290 // Include negative zero, infinity. | 280 // Include negative zero, infinity. |
| 291 return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); | 281 return Bool::Get(signbit(arg.value()) && !isnan(arg.value())); |
| 292 } | 282 } |
| 293 | 283 |
| 294 // Add here only functions using/referring to old-style casts. | 284 // Add here only functions using/referring to old-style casts. |
| 295 | 285 |
| 296 } // namespace dart | 286 } // namespace dart |
| OLD | NEW |