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

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

Issue 11299121: Remove abstract from class members in dart libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « sdk/lib/core/comparable.dart ('k') | sdk/lib/core/hashable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO: Convert this abstract class into a concrete class double 5 // TODO: Convert this abstract class into a concrete class double
6 // that uses the patch class functionality to account for the 6 // that uses the patch class functionality to account for the
7 // different platform implementations. 7 // different platform implementations.
8 8
9 /** 9 /**
10 * Representation of Dart doubles containing double specific constants 10 * Representation of Dart doubles containing double specific constants
11 * and operations and specializations of operations inherited from 11 * and operations and specializations of operations inherited from
12 * [num]. 12 * [num].
13 * 13 *
14 * The [double] type is contagious. Operations on [double]s return 14 * The [double] type is contagious. Operations on [double]s return
15 * [double] results. 15 * [double] results.
16 */ 16 */
17 abstract class double extends num { 17 abstract class double extends num {
18 static const double NAN = 0.0 / 0.0; 18 static const double NAN = 0.0 / 0.0;
19 static const double INFINITY = 1.0 / 0.0; 19 static const double INFINITY = 1.0 / 0.0;
20 static const double NEGATIVE_INFINITY = -INFINITY; 20 static const double NEGATIVE_INFINITY = -INFINITY;
21 static const double MIN_POSITIVE = 5e-324; 21 static const double MIN_POSITIVE = 5e-324;
22 static const double MAX_FINITE = 1.7976931348623157e+308; 22 static const double MAX_FINITE = 1.7976931348623157e+308;
23 23
24 /** Return the remainder from dividing this [double] by [other]. */ 24 /** Return the remainder from dividing this [double] by [other]. */
25 abstract double remainder(num other); 25 double remainder(num other);
26 26
27 /** Addition operator. */ 27 /** Addition operator. */
28 abstract double operator +(num other); 28 double operator +(num other);
29 29
30 /** Subtraction operator. */ 30 /** Subtraction operator. */
31 abstract double operator -(num other); 31 double operator -(num other);
32 32
33 /** Multiplication operator. */ 33 /** Multiplication operator. */
34 abstract double operator *(num other); 34 double operator *(num other);
35 35
36 /** Euclidean modulo operator. */ 36 /** Euclidean modulo operator. */
37 abstract double operator %(num other); 37 double operator %(num other);
38 38
39 /** Division operator. */ 39 /** Division operator. */
40 abstract double operator /(num other); 40 double operator /(num other);
41 41
42 /** 42 /**
43 * Truncating division operator. 43 * Truncating division operator.
44 * 44 *
45 * The result of the truncating division [:a ~/ b:] is equivalent to 45 * The result of the truncating division [:a ~/ b:] is equivalent to
46 * [:(a / b).truncate():]. 46 * [:(a / b).truncate():].
47 */ 47 */
48 abstract double operator ~/(num other); 48 double operator ~/(num other);
49 49
50 /** Negate operator. */ 50 /** Negate operator. */
51 abstract double operator -(); 51 double operator -();
52 52
53 /** Returns the absolute value of this [double]. */ 53 /** Returns the absolute value of this [double]. */
54 abstract double abs(); 54 double abs();
55 55
56 /** 56 /**
57 * Returns the integer value closest to this [double]. 57 * Returns the integer value closest to this [double].
58 * 58 *
59 * Rounds away from zero when there is no closest integer: 59 * Rounds away from zero when there is no closest integer:
60 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:]. 60 * [:(3.5).round() == 4:] and [:(-3.5).round() == -4:].
61 */ 61 */
62 abstract double round(); 62 double round();
63 63
64 /** Returns the greatest integer value no greater than this [double]. */ 64 /** Returns the greatest integer value no greater than this [double]. */
65 abstract double floor(); 65 double floor();
66 66
67 /** Returns the least integer value that is no smaller than this [double]. */ 67 /** Returns the least integer value that is no smaller than this [double]. */
68 abstract double ceil(); 68 double ceil();
69 69
70 /** 70 /**
71 * Returns the integer value obtained by discarding any fractional 71 * Returns the integer value obtained by discarding any fractional
72 * digits from this [double]. 72 * digits from this [double].
73 */ 73 */
74 abstract double truncate(); 74 double truncate();
75 75
76 /** 76 /**
77 * Provide a representation of this [double] value. 77 * Provide a representation of this [double] value.
78 * 78 *
79 * The representation is a number literal such that the closest double value 79 * The representation is a number literal such that the closest double value
80 * to the representation's mathematical value is this [double]. 80 * to the representation's mathematical value is this [double].
81 * 81 *
82 * Returns "NaN" for the Not-a-Number value. 82 * Returns "NaN" for the Not-a-Number value.
83 * Returns "Infinity" and "-Infinity" for positive and negative Infinity. 83 * Returns "Infinity" and "-Infinity" for positive and negative Infinity.
84 * Returns "-0.0" for negative zero. 84 * Returns "-0.0" for negative zero.
85 * 85 *
86 * It should always be the case that if [:d:] is a [double], then 86 * It should always be the case that if [:d:] is a [double], then
87 * [:d == double.parse(d.toString()):]. 87 * [:d == double.parse(d.toString()):].
88 */ 88 */
89 abstract String toString(); 89 String toString();
90 90
91 /** 91 /**
92 * Parse [source] as an double literal and return its value. 92 * Parse [source] as an double literal and return its value.
93 * 93 *
94 * Accepts the same format as double literals: 94 * Accepts the same format as double literals:
95 * [: ['+'|'-'] [digit* '.'] digit+ [('e'|'E') ['+'|'-'] digit+] :] 95 * [: ['+'|'-'] [digit* '.'] digit+ [('e'|'E') ['+'|'-'] digit+] :]
96 * 96 *
97 * Also recognizes "NaN", "Infinity" and "-Infinity" as inputs and 97 * Also recognizes "NaN", "Infinity" and "-Infinity" as inputs and
98 * returns the corresponding double value. 98 * returns the corresponding double value.
99 * 99 *
100 * Throws a [FormatException] if [source] is not a valid double literal. 100 * Throws a [FormatException] if [source] is not a valid double literal.
101 */ 101 */
102 external static double parse(String source); 102 external static double parse(String source);
103 } 103 }
OLDNEW
« no previous file with comments | « sdk/lib/core/comparable.dart ('k') | sdk/lib/core/hashable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698