OLD | NEW |
---|---|
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 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 /** Division operator. */ | 41 /** Division operator. */ |
42 double operator /(num other); | 42 double operator /(num other); |
43 | 43 |
44 /** | 44 /** |
45 * Truncating division operator. | 45 * Truncating division operator. |
46 * | 46 * |
47 * The result of the truncating division [:a ~/ b:] is equivalent to | 47 * The result of the truncating division [:a ~/ b:] is equivalent to |
48 * [:(a / b).truncate():]. | 48 * [:(a / b).truncate():]. |
49 */ | 49 */ |
50 double operator ~/(num other); | 50 int operator ~/(num other); |
51 | 51 |
52 /** Negate operator. */ | 52 /** Negate operator. */ |
53 double operator -(); | 53 double operator -(); |
54 | 54 |
55 /** Returns the absolute value of this [double]. */ | 55 /** Returns the absolute value of this [double]. */ |
56 double abs(); | 56 double abs(); |
57 | 57 |
58 /** | 58 /** |
59 * Returns the integer value closest to this [double]. | 59 * Returns the integer closest to [this]. Throws a [FormatException] if |
Lasse Reichstein Nielsen
2013/01/04 10:29:42
UnsupportedError.
| |
60 * [this] cannot be converted. | |
60 * | 61 * |
61 * Rounds away from zero when there is no closest integer: | 62 * Rounds away from zero when there is no closest integer: |
62 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. | 63 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. |
63 */ | 64 */ |
64 double round(); | 65 int round(); |
65 | |
66 /** Returns the greatest integer value no greater than this [double]. */ | |
67 double floor(); | |
68 | |
69 /** Returns the least integer value that is no smaller than this [double]. */ | |
70 double ceil(); | |
71 | 66 |
72 /** | 67 /** |
73 * Returns the integer value obtained by discarding any fractional | 68 * Returns the greatest integer no greater than [this] Throws a |
74 * digits from this [double]. | 69 * [FormatException] if [this] cannot be converted. |
75 */ | 70 */ |
76 double truncate(); | 71 int floor(); |
72 | |
73 /** | |
74 * Returns the least integer that is no smaller than [this]. Throws a | |
75 * [FormatException] if [this] cannot be converted. | |
76 */ | |
77 int ceil(); | |
78 | |
79 /** | |
80 * Returns the integer obtained by discarding any fractional digits from | |
81 * [this]. Throws a [FormatException] if [this] cannot be converted. | |
82 */ | |
83 int truncate(); | |
77 | 84 |
78 /** | 85 /** |
79 * Provide a representation of this [double] value. | 86 * Provide a representation of this [double] value. |
80 * | 87 * |
81 * The representation is a number literal such that the closest double value | 88 * The representation is a number literal such that the closest double value |
82 * to the representation's mathematical value is this [double]. | 89 * to the representation's mathematical value is this [double]. |
83 * | 90 * |
84 * Returns "NaN" for the Not-a-Number value. | 91 * Returns "NaN" for the Not-a-Number value. |
85 * Returns "Infinity" and "-Infinity" for positive and negative Infinity. | 92 * Returns "Infinity" and "-Infinity" for positive and negative Infinity. |
86 * Returns "-0.0" for negative zero. | 93 * Returns "-0.0" for negative zero. |
(...skipping 13 matching lines...) Expand all Loading... | |
100 * returns the corresponding double value. | 107 * returns the corresponding double value. |
101 * | 108 * |
102 * If the [soure] is not a valid double literal, the [handleError] | 109 * If the [soure] is not a valid double literal, the [handleError] |
103 * is called with the [source] as argument, and its return value is | 110 * is called with the [source] as argument, and its return value is |
104 * used instead. If no handleError is provided, a [FormatException] | 111 * used instead. If no handleError is provided, a [FormatException] |
105 * is thrown. | 112 * is thrown. |
106 */ | 113 */ |
107 external static double parse(String source, | 114 external static double parse(String source, |
108 [double handleError(String source)]); | 115 [double handleError(String source)]); |
109 } | 116 } |
OLD | NEW |