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

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

Issue 113833002: Add num.sign getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed to return same type as the number (double for doubles, int for ints). Returns -0.0 for -0.0… Created 7 years 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
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 // TODO: Convert this abstract class into a concrete class double 7 // TODO: Convert this abstract class into a concrete class double
8 // that uses the patch class functionality to account for the 8 // that uses the patch class functionality to account for the
9 // different platform implementations. 9 // different platform implementations.
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 */ 53 */
54 int operator ~/(num other); 54 int operator ~/(num other);
55 55
56 /** Negate operator. */ 56 /** Negate operator. */
57 double operator -(); 57 double operator -();
58 58
59 /** Returns the absolute value of this [double]. */ 59 /** Returns the absolute value of this [double]. */
60 double abs(); 60 double abs();
61 61
62 /** 62 /**
63 * Returns the sign of the double's numerical value.
64 *
65 * Returns -1.0 if the value is less than zero,
66 * +1.0 if the value is greater than zero,
67 * and the value itself if it is -0.0, 0.0 or NaN.
68 */
69 double get sign;
70
71 /**
63 * Returns the integer closest to `this`. 72 * Returns the integer closest to `this`.
64 * 73 *
65 * Rounds away from zero when there is no closest integer: 74 * Rounds away from zero when there is no closest integer:
66 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. 75 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
67 * 76 *
68 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError]. 77 * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
69 */ 78 */
70 int round(); 79 int round();
71 80
72 /** 81 /**
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 * "0." 175 * "0."
167 * ".0" 176 * ".0"
168 * "-1.e3" 177 * "-1.e3"
169 * "1234E+7" 178 * "1234E+7"
170 * "+.12e-9" 179 * "+.12e-9"
171 * "-NaN" 180 * "-NaN"
172 */ 181 */
173 external static double parse(String source, 182 external static double parse(String source,
174 [double onError(String source)]); 183 [double onError(String source)]);
175 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698