| 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * An integer or floating-point number. | 8 * An integer or floating-point number. |
| 9 * | 9 * |
| 10 * It is a compile-time error for any type other than [int] or [double] | 10 * It is a compile-time error for any type other than [int] or [double] |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 * | 163 * |
| 164 * The only non-finite numbers are NaN, positive infinitity and | 164 * The only non-finite numbers are NaN, positive infinitity and |
| 165 * negative infinity. | 165 * negative infinity. |
| 166 */ | 166 */ |
| 167 bool get isFinite; | 167 bool get isFinite; |
| 168 | 168 |
| 169 /** Returns the absolute value of this [num]. */ | 169 /** Returns the absolute value of this [num]. */ |
| 170 num abs(); | 170 num abs(); |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Returns minus one, zero or plus one depending on the sign and |
| 174 * numerical value of the number. |
| 175 * |
| 176 * Returns minus one if the number is less than zero, |
| 177 * plus one if the number is greater than zero, |
| 178 * and zero if the number is equal to zero. |
| 179 * |
| 180 * Returns NaN if the number is the double NaN value. |
| 181 * |
| 182 * Returns a number of the same type as this number. |
| 183 * For doubles, `-0.0.sign == -0.0`. |
| 184 |
| 185 * The result satisfies: |
| 186 * |
| 187 * n == n.sign * n.abs() |
| 188 * |
| 189 * for all numbers `n` (except NaN, because NaN isn't `==` to itself). |
| 190 */ |
| 191 num get sign; |
| 192 |
| 193 /** |
| 173 * Returns the integer closest to `this`. | 194 * Returns the integer closest to `this`. |
| 174 * | 195 * |
| 175 * Rounds away from zero when there is no closest integer: | 196 * Rounds away from zero when there is no closest integer: |
| 176 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. | 197 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. |
| 177 * | 198 * |
| 178 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. | 199 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. |
| 179 */ | 200 */ |
| 180 int round(); | 201 int round(); |
| 181 | 202 |
| 182 /** | 203 /** |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (result != null) return result; | 403 if (result != null) return result; |
| 383 result = double.parse(source, _returnNull); | 404 result = double.parse(source, _returnNull); |
| 384 if (result != null) return result; | 405 if (result != null) return result; |
| 385 if (onError == null) throw new FormatException(input); | 406 if (onError == null) throw new FormatException(input); |
| 386 return onError(input); | 407 return onError(input); |
| 387 } | 408 } |
| 388 | 409 |
| 389 /** Helper function for [parse]. */ | 410 /** Helper function for [parse]. */ |
| 390 static _returnNull(_) => null; | 411 static _returnNull(_) => null; |
| 391 } | 412 } |
| OLD | NEW |