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

Side by Side Diff: runtime/lib/double.cc

Issue 353403004: Fixes Android build by using C++ math header instead of C one. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/platform/c99_support_win.h » ('j') | runtime/vm/simulator_arm64.cc » ('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 <math.h> 5 #include <cmath>
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.
11 #include "vm/double_conversion.h" 11 #include "vm/double_conversion.h"
12 #include "vm/exceptions.h" 12 #include "vm/exceptions.h"
13 #include "vm/native_entry.h" 13 #include "vm/native_entry.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/symbols.h" 15 #include "vm/symbols.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1)); 66 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
67 double right = right_object.value(); 67 double right = right_object.value();
68 if (FLAG_trace_intrinsified_natives) { 68 if (FLAG_trace_intrinsified_natives) {
69 OS::Print("Double_div %f / %f\n", left, right); 69 OS::Print("Double_div %f / %f\n", left, right);
70 } 70 }
71 return Double::New(left / right); 71 return Double::New(left / right);
72 } 72 }
73 73
74 74
75 static RawInteger* DoubleToInteger(double val, const char* error_msg) { 75 static RawInteger* DoubleToInteger(double val, const char* error_msg) {
76 if (isinf(val) || isnan(val)) { 76 if (std::isinf(val) || std::isnan(val)) {
77 const Array& args = Array::Handle(Array::New(1)); 77 const Array& args = Array::Handle(Array::New(1));
78 args.SetAt(0, String::Handle(String::New(error_msg))); 78 args.SetAt(0, String::Handle(String::New(error_msg)));
79 Exceptions::ThrowByType(Exceptions::kUnsupported, args); 79 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
80 } 80 }
81 const Bigint& big = Bigint::Handle(BigintOperations::NewFromDouble(val)); 81 const Bigint& big = Bigint::Handle(BigintOperations::NewFromDouble(val));
82 return big.AsValidInteger(); 82 return big.AsValidInteger();
83 } 83 }
84 84
85 85
86 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) { 86 DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } else { 251 } else {
252 Exceptions::ThrowArgumentError(String::Handle( 252 Exceptions::ThrowArgumentError(String::Handle(
253 String::New("Illegal arguments to double.toStringAsPrecision"))); 253 String::New("Illegal arguments to double.toStringAsPrecision")));
254 return Object::null(); 254 return Object::null();
255 } 255 }
256 } 256 }
257 257
258 258
259 DEFINE_NATIVE_ENTRY(Double_getIsInfinite, 1) { 259 DEFINE_NATIVE_ENTRY(Double_getIsInfinite, 1) {
260 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); 260 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
261 return Bool::Get(isinf(arg.value())).raw(); 261 return Bool::Get(std::isinf(arg.value())).raw();
262 } 262 }
263 263
264 264
265 DEFINE_NATIVE_ENTRY(Double_getIsNaN, 1) { 265 DEFINE_NATIVE_ENTRY(Double_getIsNaN, 1) {
266 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); 266 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
267 return Bool::Get(isnan(arg.value())).raw(); 267 return Bool::Get(std::isnan(arg.value())).raw();
268 } 268 }
269 269
270 270
271 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) { 271 DEFINE_NATIVE_ENTRY(Double_getIsNegative, 1) {
272 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0)); 272 const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
273 // Include negative zero, infinity. 273 // Include negative zero, infinity.
274 double dval = arg.value(); 274 double dval = arg.value();
275 return Bool::Get(signbit(dval) && !isnan(dval)).raw(); 275 return Bool::Get(std::signbit(dval) && !std::isnan(dval)).raw();
276 } 276 }
277 277
278 // Add here only functions using/referring to old-style casts. 278 // Add here only functions using/referring to old-style casts.
279 279
280 } // namespace dart 280 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/platform/c99_support_win.h » ('j') | runtime/vm/simulator_arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698