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

Side by Side Diff: lib/double.dart

Issue 10918213: - Move double and int implementations into dart:core and make them private. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/integers.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class Double implements double { 5 class _Double implements double {
6 factory Double.fromInteger(int value) 6 factory _Double.fromInteger(int value)
7 native "Double_doubleFromInteger"; 7 native "Double_doubleFromInteger";
8 int hashCode() { 8 int hashCode() {
9 try { 9 try {
10 return toInt(); 10 return toInt();
11 } on FormatException catch (e) { 11 } on FormatException catch (e) {
12 return 0; 12 return 0;
13 } 13 }
14 } 14 }
15 double operator +(num other) { 15 double operator +(num other) {
16 return add_(other.toDouble()); 16 return add_(other.toDouble());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return greaterThan_(other.toDouble()); 67 return greaterThan_(other.toDouble());
68 } 68 }
69 bool greaterThan_(double other) native "Double_greaterThan"; 69 bool greaterThan_(double other) native "Double_greaterThan";
70 bool operator >=(num other) { 70 bool operator >=(num other) {
71 return (this == other) || (this > other); 71 return (this == other) || (this > other);
72 } 72 }
73 bool operator <=(num other) { 73 bool operator <=(num other) {
74 return (this == other) || (this < other); 74 return (this == other) || (this < other);
75 } 75 }
76 double addFromInteger(int other) { 76 double addFromInteger(int other) {
77 return new Double.fromInteger(other) + this; 77 return new _Double.fromInteger(other) + this;
78 } 78 }
79 double subFromInteger(int other) { 79 double subFromInteger(int other) {
80 return new Double.fromInteger(other) - this; 80 return new _Double.fromInteger(other) - this;
81 } 81 }
82 double mulFromInteger(int other) { 82 double mulFromInteger(int other) {
83 return new Double.fromInteger(other) * this; 83 return new _Double.fromInteger(other) * this;
84 } 84 }
85 double truncDivFromInteger(int other) { 85 double truncDivFromInteger(int other) {
86 return new Double.fromInteger(other) ~/ this; 86 return new _Double.fromInteger(other) ~/ this;
87 } 87 }
88 double moduloFromInteger(int other) { 88 double moduloFromInteger(int other) {
89 return new Double.fromInteger(other) % this; 89 return new _Double.fromInteger(other) % this;
90 } 90 }
91 double remainderFromInteger(int other) { 91 double remainderFromInteger(int other) {
92 return new Double.fromInteger(other).remainder(this); 92 return new _Double.fromInteger(other).remainder(this);
93 } 93 }
94 94
95 bool greaterThanFromInteger(int other) native "Double_greaterThanFromInteger"; 95 bool greaterThanFromInteger(int other) native "Double_greaterThanFromInteger";
96 96
97 bool isNegative() native "Double_isNegative"; 97 bool isNegative() native "Double_isNegative";
98 bool isInfinite() native "Double_isInfinite"; 98 bool isInfinite() native "Double_isInfinite";
99 bool isNaN() native "Double_isNaN"; 99 bool isNaN() native "Double_isNaN";
100 100
101 double abs() { 101 double abs() {
102 // Handle negative 0.0. 102 // Handle negative 0.0.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return EQUAL; 222 return EQUAL;
223 } 223 }
224 } else if (isNaN()) { 224 } else if (isNaN()) {
225 return other.isNaN() ? EQUAL : GREATER; 225 return other.isNaN() ? EQUAL : GREATER;
226 } else { 226 } else {
227 // Other is NaN. 227 // Other is NaN.
228 return LESS; 228 return LESS;
229 } 229 }
230 } 230 }
231 } 231 }
OLDNEW
« no previous file with comments | « no previous file | lib/integers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698