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

Unified Diff: sdk/lib/core/double.dart

Issue 12317107: ceil/floor/truncate/round return integers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error3 Created 7 years, 9 months 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
« no previous file with comments | « sdk/lib/core/date_time.dart ('k') | sdk/lib/core/int.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/double.dart
diff --git a/sdk/lib/core/double.dart b/sdk/lib/core/double.dart
index 0b3417f3232ea7af16a3bae325f33f46f6ae113a..58bb3dd0c349f462fe4abe65a7492c7b47210670 100644
--- a/sdk/lib/core/double.dart
+++ b/sdk/lib/core/double.dart
@@ -45,7 +45,7 @@ abstract class double extends num {
* Truncating division operator.
*
* The result of the truncating division [:a ~/ b:] is equivalent to
- * [:(a / b).truncate().toInt():].
+ * [:(a / b).truncate():].
*/
int operator ~/(num other);
@@ -56,24 +56,66 @@ abstract class double extends num {
double abs();
/**
- * Returns the integer value closest to this [double].
+ * Returns the integer closest to `this`.
*
* Rounds away from zero when there is no closest integer:
* [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
+ *
+ * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
+ */
+ int round();
+
+ /**
+ * Returns the greatest integer no greater than `this`.
+ *
+ * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
+ */
+ int floor();
+
+ /**
+ * Returns the least integer no smaller than `this`.
+ *
+ * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
+ */
+ int ceil();
+
+ /**
+ * Returns the integer obtained by discarding any fractional
+ * digits from `this`.
+ *
+ * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
*/
- double round();
+ int truncate();
- /** Returns the greatest integer value no greater than this [double]. */
- double floor();
+ /**
+ * Returns the integer value, as a double, closest to `this`.
+ *
+ * Rounds away from zero when there is no closest integer:
+ * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
+ */
+ double roundToDouble();
- /** Returns the least integer value that is no smaller than this [double]. */
- double ceil();
+ /**
+ * Returns the greatest integer value no greater than `this`.
+ *
+ * The result is a double.
+ */
+ double floorToDouble();
+
+ /**
+ * Returns the least integer value no smaller than `this`.
+ *
+ * The result is a double.
+ */
+ double ceilToDouble();
/**
- * Returns the integer value obtained by discarding any fractional
- * digits from this [double].
+ * Returns the integer obtained by discarding any fractional
+ * digits from `this`.
+ *
+ * The result is a double.
*/
- double truncate();
+ double truncateToDouble();
/**
* Provide a representation of this [double] value.
« no previous file with comments | « sdk/lib/core/date_time.dart ('k') | sdk/lib/core/int.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698