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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/core/double.dart
diff --git a/sdk/lib/core/double.dart b/sdk/lib/core/double.dart
index 4aa161b851111cd7e04393e1d3b1cc60f53f5cd7..53964e4e0be8c93202b58a4bc9fa920f85460947 100644
--- a/sdk/lib/core/double.dart
+++ b/sdk/lib/core/double.dart
@@ -60,6 +60,15 @@ abstract class double extends num {
double abs();
/**
+ * Returns the sign of the double's numerical value.
+ *
+ * Returns -1.0 if the value is less than zero,
+ * +1.0 if the value is greater than zero,
+ * and the value itself if it is -0.0, 0.0 or NaN.
+ */
+ double get sign;
+
+ /**
* Returns the integer closest to `this`.
*
* Rounds away from zero when there is no closest integer:

Powered by Google App Engine
This is Rietveld 408576698