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 /** | 5 /** |
6 * Mathematical constants and functions, plus a random number generator. | 6 * Mathematical constants and functions, plus a random number generator. |
7 */ | 7 */ |
8 library dart.math; | 8 library dart.math; |
9 | 9 |
10 part "random.dart"; | 10 part "random.dart"; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 * the direction of the vector along the x-axis. | 130 * the direction of the vector along the x-axis. |
131 * | 131 * |
132 * Returns NaN if either argument is NaN. | 132 * Returns NaN if either argument is NaN. |
133 */ | 133 */ |
134 external double atan2(num a, num b); | 134 external double atan2(num a, num b); |
135 | 135 |
136 /** | 136 /** |
137 * Returns [x] to the power of [exponent]. | 137 * Returns [x] to the power of [exponent]. |
138 * | 138 * |
139 * If [x] is an [int] and [exponent] is a non-negative [int], the result is | 139 * If [x] is an [int] and [exponent] is a non-negative [int], the result is |
140 * an [int], otherwise the result it is a [double]. | 140 * an [int], otherwise both arguments are converted to doubles first, and the |
141 * result is a [double]. | |
142 * | |
143 * For integers, the power is always equal to the mathematical result of `x` to | |
144 * the power `exponent`, only limited by the available memory. | |
145 * | |
146 * For doubles, `pow` handles edge cases as follows: | |
147 * | |
148 * - `pow(x, ±0.0)` is 1, no matter what `x` is. | |
149 * - `pow(1, y)` is 1, no matter what `y` is. | |
150 * - `pow(−1, ±∞)` is always 1. | |
151 * - `pow(±0, y)` is infinite if y is negative. If the first argument | |
floitsch
2013/08/19 14:47:31
there are two items +-0, y.
The next list-item see
| |
152 * is negative zero and `y` is a negative integer, then the result is | |
153 * negative infinity, otherwise it is positive infinity. | |
154 * - `pow(±0, y)` is zero if y is non-negative. If the first argument is | |
155 * negative zero and y is an odd integer, then the results is -0.0, otherwise | |
156 * is is 0.0. | |
157 * - `pow(±0, −∞)` is positive infinity. | |
floitsch
2013/08/19 14:47:31
put the special cases first. Otherwise the generic
| |
158 * - `pow(±0, ∞)` is 0.0. | |
159 * - `pow(x, y)` is `NaN` if x is negative and y is a finite non-integer. | |
160 * | |
161 * This corresponds to the `pow` function defined in the IEEE Standard 754-2008. | |
141 * | 162 * |
142 * Notice that an [int] result cannot overflow, but a [double] result might | 163 * Notice that an [int] result cannot overflow, but a [double] result might |
143 * be [double.INFINITY]. | 164 * be [double.INFINITY]. |
144 */ | 165 */ |
145 external num pow(num x, num exponent); | 166 external num pow(num x, num exponent); |
146 | 167 |
147 /** | 168 /** |
148 * Converts [x] to a double and returns the sine of the value. | 169 * Converts [x] to a double and returns the sine of the value. |
149 * | 170 * |
150 * If [x] is not a finite number, the result is NaN. | 171 * If [x] is not a finite number, the result is NaN. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 * Returns NaN if [x] is NaN. | 222 * Returns NaN if [x] is NaN. |
202 */ | 223 */ |
203 external double exp(num x); | 224 external double exp(num x); |
204 | 225 |
205 /** | 226 /** |
206 * Converts [x] to a double and returns the natural logarithm of the value. | 227 * Converts [x] to a double and returns the natural logarithm of the value. |
207 * Returns negative infinity if [x] is equal to zero. | 228 * Returns negative infinity if [x] is equal to zero. |
208 * Returns NaN if [x] is NaN or less than zero. | 229 * Returns NaN if [x] is NaN or less than zero. |
209 */ | 230 */ |
210 external double log(num x); | 231 external double log(num x); |
OLD | NEW |