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

Side by Side Diff: runtime/lib/math.dart

Issue 10913271: Move parseInt parseDouble to int/double classes as a static method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make int.parse directly native. Created 8 years, 3 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 | « runtime/lib/lib_sources.gypi ('k') | runtime/lib/math_patch.dart » ('j') | no next file with comments »
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 class MathNatives { 5 class MathNatives {
6 static num pow(num value, num exponent) { 6 static num pow(num value, num exponent) {
7 if (exponent is int) { 7 if (exponent is int) {
8 return value.pow(exponent); 8 return value.pow(exponent);
9 } 9 }
10 // Double.pow will call exponent.toDouble(). 10 // Double.pow will call exponent.toDouble().
11 return value.toDouble().pow(exponent); 11 return value.toDouble().pow(exponent);
12 } 12 }
13 static double random() => _random(); 13 static double random() => _random();
14 static double sqrt(num value) => _sqrt(value.toDouble()); 14 static double sqrt(num value) => _sqrt(value.toDouble());
15 static double sin(num value) => _sin(value.toDouble()); 15 static double sin(num value) => _sin(value.toDouble());
16 static double cos(num value) => _cos(value.toDouble()); 16 static double cos(num value) => _cos(value.toDouble());
17 static double tan(num value) => _tan(value.toDouble()); 17 static double tan(num value) => _tan(value.toDouble());
18 static double acos(num value) => _acos(value.toDouble()); 18 static double acos(num value) => _acos(value.toDouble());
19 static double asin(num value) => _asin(value.toDouble()); 19 static double asin(num value) => _asin(value.toDouble());
20 static double atan(num value) => _atan(value.toDouble()); 20 static double atan(num value) => _atan(value.toDouble());
21 static double atan2(num a, num b) => _atan2(a.toDouble(), b.toDouble()); 21 static double atan2(num a, num b) => _atan2(a.toDouble(), b.toDouble());
22 static double exp(num value) => _exp(value.toDouble()); 22 static double exp(num value) => _exp(value.toDouble());
23 static double log(num value) => _log(value.toDouble()); 23 static double log(num value) => _log(value.toDouble());
24 static int parseInt(String str) => _parseInt(str);
25 static double parseDouble(String str) => _parseDouble(str);
26 24
27 static double _random() native "MathNatives_random"; 25 static double _random() native "MathNatives_random";
28 static double _sqrt(double value) native "MathNatives_sqrt"; 26 static double _sqrt(double value) native "MathNatives_sqrt";
29 static double _sin(double value) native "MathNatives_sin"; 27 static double _sin(double value) native "MathNatives_sin";
30 static double _cos(double value) native "MathNatives_cos"; 28 static double _cos(double value) native "MathNatives_cos";
31 static double _tan(double value) native "MathNatives_tan"; 29 static double _tan(double value) native "MathNatives_tan";
32 static double _acos(double value) native "MathNatives_acos"; 30 static double _acos(double value) native "MathNatives_acos";
33 static double _asin(double value) native "MathNatives_asin"; 31 static double _asin(double value) native "MathNatives_asin";
34 static double _atan(double value) native "MathNatives_atan"; 32 static double _atan(double value) native "MathNatives_atan";
35 static double _atan2(double a, double b) native "MathNatives_atan2"; 33 static double _atan2(double a, double b) native "MathNatives_atan2";
36 static double _exp(double value) native "MathNatives_exp"; 34 static double _exp(double value) native "MathNatives_exp";
37 static double _log(double value) native "MathNatives_log"; 35 static double _log(double value) native "MathNatives_log";
38 static int _parseInt(String str) native "MathNatives_parseInt";
39 static double _parseDouble(String str) native "MathNatives_parseDouble";
40 } 36 }
OLDNEW
« no previous file with comments | « runtime/lib/lib_sources.gypi ('k') | runtime/lib/math_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698