Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 | 135 |
| 136 /** Relational less than or equal operator. */ | 136 /** Relational less than or equal operator. */ |
| 137 bool operator <=(num other); | 137 bool operator <=(num other); |
| 138 | 138 |
| 139 /** Relational greater than operator. */ | 139 /** Relational greater than operator. */ |
| 140 bool operator >(num other); | 140 bool operator >(num other); |
| 141 | 141 |
| 142 /** Relational greater than or equal operator. */ | 142 /** Relational greater than or equal operator. */ |
| 143 bool operator >=(num other); | 143 bool operator >=(num other); |
| 144 | 144 |
| 145 /** Whether the number is the double Not-a-Number value. */ | |
| 145 bool get isNaN; | 146 bool get isNaN; |
| 146 | 147 |
| 148 /** | |
| 149 * Whether the number is negative. | |
| 150 * | |
| 151 * Negative numbers are those less than zero, and the double `-0.0`. | |
| 152 */ | |
| 147 bool get isNegative; | 153 bool get isNegative; |
| 148 | 154 |
| 155 /** | |
| 156 * Whether the number is the double positive or negative infinity. | |
|
floitsch
2013/10/18 11:54:59
double reads bad here.
Lasse Reichstein Nielsen
2013/10/23 10:21:38
Done.
| |
| 157 */ | |
| 149 bool get isInfinite; | 158 bool get isInfinite; |
| 150 | 159 |
| 160 /** | |
| 161 * Whether the number is finite. | |
| 162 * | |
| 163 * The only non-finite numbers are NaN and positive or negative infinity. | |
|
floitsch
2013/10/18 11:54:59
nit. I prefer:
NaN, positive infinity and negative
Lasse Reichstein Nielsen
2013/10/23 10:21:38
Done.
| |
| 164 */ | |
| 165 bool get isFinite; | |
| 166 | |
| 151 /** Returns the absolute value of this [num]. */ | 167 /** Returns the absolute value of this [num]. */ |
| 152 num abs(); | 168 num abs(); |
| 153 | 169 |
| 154 /** | 170 /** |
| 155 * Returns the integer closest to `this`. | 171 * Returns the integer closest to `this`. |
| 156 * | 172 * |
| 157 * Rounds away from zero when there is no closest integer: | 173 * Rounds away from zero when there is no closest integer: |
| 158 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. | 174 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. |
| 159 * | 175 * |
| 160 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. | 176 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 * | 351 * |
| 336 * Note: the conversion may round the output if the returned string | 352 * Note: the conversion may round the output if the returned string |
| 337 * is accurate enough to uniquely identify the input-number. | 353 * is accurate enough to uniquely identify the input-number. |
| 338 * For example the most precise representation of the [double] `9e59` equals | 354 * For example the most precise representation of the [double] `9e59` equals |
| 339 * `"899999999999999918767229449717619953810131273674690656206848"`, but | 355 * `"899999999999999918767229449717619953810131273674690656206848"`, but |
| 340 * this method returns the shorter (but still uniquely identifying) `"9e59"`. | 356 * this method returns the shorter (but still uniquely identifying) `"9e59"`. |
| 341 * | 357 * |
| 342 */ | 358 */ |
| 343 String toString(); | 359 String toString(); |
| 344 } | 360 } |
| OLD | NEW |