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

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

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 12 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
Index: sdk/lib/core/double.dart
diff --git a/sdk/lib/core/double.dart b/sdk/lib/core/double.dart
index 7b82213aaabadd8c09c31d7b1efebb571cf8a491..45a415f9cca0d0e32df81cd0e340e8ed5b5e20f9 100644
--- a/sdk/lib/core/double.dart
+++ b/sdk/lib/core/double.dart
@@ -47,7 +47,7 @@ abstract class double extends num {
* The result of the truncating division [:a ~/ b:] is equivalent to
* [:(a / b).truncate():].
*/
- double operator ~/(num other);
+ int operator ~/(num other);
/** Negate operator. */
double operator -();
@@ -56,24 +56,31 @@ abstract class double extends num {
double abs();
/**
- * Returns the integer value closest to this [double].
+ * Returns the integer closest to [this]. Throws a [FormatException] if
Lasse Reichstein Nielsen 2013/01/04 10:29:42 UnsupportedError.
+ * [this] cannot be converted.
*
* Rounds away from zero when there is no closest integer:
* [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
*/
- double round();
+ int round();
- /** Returns the greatest integer value no greater than this [double]. */
- double floor();
+ /**
+ * Returns the greatest integer no greater than [this] Throws a
+ * [FormatException] if [this] cannot be converted.
+ */
+ int floor();
- /** Returns the least integer value that is no smaller than this [double]. */
- double ceil();
+ /**
+ * Returns the least integer that is no smaller than [this]. Throws a
+ * [FormatException] if [this] cannot be converted.
+ */
+ int ceil();
/**
- * Returns the integer value obtained by discarding any fractional
- * digits from this [double].
+ * Returns the integer obtained by discarding any fractional digits from
+ * [this]. Throws a [FormatException] if [this] cannot be converted.
*/
- double truncate();
+ int truncate();
/**
* Provide a representation of this [double] value.

Powered by Google App Engine
This is Rietveld 408576698