| OLD | NEW |
| 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 * Typically written as "e". | 10 * Typically written as "e". |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // returns NaN if b is NaN. | 78 // returns NaN if b is NaN. |
| 79 return (a + b) * a * b; | 79 return (a + b) * a * b; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 // Check for NaN and b == -0.0. | 82 // Check for NaN and b == -0.0. |
| 83 if (a == 0 && b.isNegative() || b.isNaN()) return b; | 83 if (a == 0 && b.isNegative() || b.isNaN()) return b; |
| 84 return a; | 84 return a; |
| 85 } | 85 } |
| 86 return a; | 86 return a; |
| 87 } | 87 } |
| 88 throw new IllegalArgumentException(b); | 88 throw new ArgumentError(b); |
| 89 } | 89 } |
| 90 throw new IllegalArgumentException(a); | 90 throw new ArgumentError(a); |
| 91 } | 91 } |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * Returns the larger of two numbers. | 94 * Returns the larger of two numbers. |
| 95 * | 95 * |
| 96 * Returns NaN if either argument is NaN. | 96 * Returns NaN if either argument is NaN. |
| 97 * The larger of [:-0.0:] and [:0.0:] is [:0.0:]. If the arguments are | 97 * The larger of [:-0.0:] and [:0.0:] is [:0.0:]. If the arguments are |
| 98 * otherwise equal (including int and doubles with the same mathematical value) | 98 * otherwise equal (including int and doubles with the same mathematical value) |
| 99 * then it is unspecified which of the two arguments is returned. | 99 * then it is unspecified which of the two arguments is returned. |
| 100 */ | 100 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 // Check for NaN. | 119 // Check for NaN. |
| 120 if (b.isNaN()) return b; | 120 if (b.isNaN()) return b; |
| 121 return a; | 121 return a; |
| 122 } | 122 } |
| 123 // max(-0.0, 0) must return 0. | 123 // max(-0.0, 0) must return 0. |
| 124 if (b == 0 && a.isNegative()) return b; | 124 if (b == 0 && a.isNegative()) return b; |
| 125 return a; | 125 return a; |
| 126 } | 126 } |
| 127 throw new IllegalArgumentException(b); | 127 throw new ArgumentError(b); |
| 128 } | 128 } |
| 129 throw new IllegalArgumentException(a); | 129 throw new ArgumentError(a); |
| 130 } | 130 } |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * A variant of [atan]. | 133 * A variant of [atan]. |
| 134 * | 134 * |
| 135 * Converts both arguments to doubles. | 135 * Converts both arguments to doubles. |
| 136 * | 136 * |
| 137 * Returns the angle between the positive x-axis and the vector ([b],[a]). | 137 * Returns the angle between the positive x-axis and the vector ([b],[a]). |
| 138 * The result, in radians, is in the range -PI..PI. | 138 * The result, in radians, is in the range -PI..PI. |
| 139 * | 139 * |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 * Returns NaN if [x] is NaN. | 218 * Returns NaN if [x] is NaN. |
| 219 */ | 219 */ |
| 220 external double exp(num x); | 220 external double exp(num x); |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * Converts [x] to a double and returns the natural logarithm of the value. | 223 * Converts [x] to a double and returns the natural logarithm of the value. |
| 224 * Returns negative infinity if [x] is equal to zero. | 224 * Returns negative infinity if [x] is equal to zero. |
| 225 * Returns NaN if [x] is NaN or less than zero. | 225 * Returns NaN if [x] is NaN or less than zero. |
| 226 */ | 226 */ |
| 227 external double log(num x); | 227 external double log(num x); |
| OLD | NEW |