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

Side by Side Diff: sdk/lib/core/num.dart

Issue 28973002: Add isFinite getter to num. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change comments to not use "whether". Created 7 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/lib/js_number.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 /** True if the number is the double Not-a-Number value; otherwise, false. */
145 bool get isNaN; 146 bool get isNaN;
146 147
148 /**
149 * True if the number is negative; otherwise, false.
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 * True if the number is positive infinity or negative infinity; otherwise,
157 * false.
158 */
149 bool get isInfinite; 159 bool get isInfinite;
150 160
161 /**
162 * True if the number is finite; otherwise, false.
163 *
164 * The only non-finite numbers are NaN, positive infinitity and
165 * negative infinity.
166 */
167 bool get isFinite;
168
151 /** Returns the absolute value of this [num]. */ 169 /** Returns the absolute value of this [num]. */
152 num abs(); 170 num abs();
153 171
154 /** 172 /**
155 * Returns the integer closest to `this`. 173 * Returns the integer closest to `this`.
156 * 174 *
157 * Rounds away from zero when there is no closest integer: 175 * Rounds away from zero when there is no closest integer:
158 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. 176 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
159 * 177 *
160 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. 178 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 * 353 *
336 * Note: the conversion may round the output if the returned string 354 * Note: the conversion may round the output if the returned string
337 * is accurate enough to uniquely identify the input-number. 355 * is accurate enough to uniquely identify the input-number.
338 * For example the most precise representation of the [double] `9e59` equals 356 * For example the most precise representation of the [double] `9e59` equals
339 * `"899999999999999918767229449717619953810131273674690656206848"`, but 357 * `"899999999999999918767229449717619953810131273674690656206848"`, but
340 * this method returns the shorter (but still uniquely identifying) `"9e59"`. 358 * this method returns the shorter (but still uniquely identifying) `"9e59"`.
341 * 359 *
342 */ 360 */
343 String toString(); 361 String toString();
344 } 362 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_number.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698