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

Side by Side Diff: corelib/unified/math/base.dart

Issue 10696147: Patch methods in classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // A part of the dart:math library. 5 // A part of the dart:math library.
6 6
7 /** 7 /**
8 * Base of the natural logarithms. 8 * Base of the natural logarithms.
9 */ 9 */
10 final double E = 2.718281828459045; 10 final double E = 2.718281828459045;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 /** 42 /**
43 * Square root of 2. 43 * Square root of 2.
44 */ 44 */
45 final double SQRT2 = 1.4142135623730951; 45 final double SQRT2 = 1.4142135623730951;
46 46
47 /** 47 /**
48 * Parses a [String] representation of an [int], and returns 48 * Parses a [String] representation of an [int], and returns
49 * an [int]. Throws a [BadNumberFormatException] if [str] 49 * an [int]. Throws a [BadNumberFormatException] if [str]
50 * cannot be parsed as an [int]. 50 * cannot be parsed as an [int].
51 */ 51 */
52 int parseInt(String str) => MathNatives.parseInt(str); 52 external int parseInt(String str);
53 53
54 /** 54 /**
55 * Parses a [String] representation of a [double], and returns 55 * Parses a [String] representation of a [double], and returns
56 * a [double]. Throws a [BadNumberFormatException] if [str] cannot 56 * a [double]. Throws a [BadNumberFormatException] if [str] cannot
57 * be parsed as a [double]. 57 * be parsed as a [double].
58 */ 58 */
59 double parseDouble(String str) => MathNatives.parseDouble(str); 59 external double parseDouble(String str);
60 60
61 num min(num a, num b) { 61 num min(num a, num b) {
62 int c = a.compareTo(b); 62 int c = a.compareTo(b);
63 if (c == 0) return a; 63 if (c == 0) return a;
64 if (c < 0) { 64 if (c < 0) {
65 if ((b is double) && b.isNaN()) return b; 65 if ((b is double) && b.isNaN()) return b;
66 return a; 66 return a;
67 } 67 }
68 if ((a is double) && a.isNaN()) return a; 68 if ((a is double) && a.isNaN()) return a;
69 return b; 69 return b;
70 } 70 }
71 71
72 num max(num a, num b) { 72 num max(num a, num b) {
73 // NaNs are handled correctly since the compareTo function always considers 73 // NaNs are handled correctly since the compareTo function always considers
74 // them to be bigger than any other operand. 74 // them to be bigger than any other operand.
75 return (a.compareTo(b) < 0) ? b : a; 75 return (a.compareTo(b) < 0) ? b : a;
76 } 76 }
77 77
78 /** 78 /**
79 * Returns the arc tangent of [a]/[b] with sign according to quadrant. 79 * Returns the arc tangent of [a]/[b] with sign according to quadrant.
80 */ 80 */
81 double atan2(num a, num b) => MathNatives.atan2(a, b); 81 external double atan2(num a, num b);
82 82
83 /** 83 /**
84 * If the [exponent] is an integer the result is of the same type as [x]. 84 * If the [exponent] is an integer the result is of the same type as [x].
85 * Otherwise it is a [double]. 85 * Otherwise it is a [double].
86 */ 86 */
87 num pow(num x, num exponent) => MathNatives.pow(x, exponent); 87 external num pow(num x, num exponent);
88 88
89 double sin(num x) => MathNatives.sin(x); 89 external double sin(num x);
90 double cos(num x) => MathNatives.cos(x); 90 external double cos(num x);
91 double tan(num x) => MathNatives.tan(x); 91 external double tan(num x);
92 double acos(num x) => MathNatives.acos(x); 92 external double acos(num x);
93 double asin(num x) => MathNatives.asin(x); 93 external double asin(num x);
94 double atan(num x) => MathNatives.atan(x); 94 external double atan(num x);
95 double sqrt(num x) => MathNatives.sqrt(x); 95 external double sqrt(num x);
96 double exp(num x) => MathNatives.exp(x); 96 external double exp(num x);
97 double log(num x) => MathNatives.log(x); 97 external double log(num x);
OLDNEW
« no previous file with comments | « no previous file | corelib/unified/math/math.dart » ('j') | lib/compiler/implementation/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698