OLD | NEW |
1 dart_library.library('dart/math', null, /* Imports */[ | 1 dart_library.library('dart/math', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core' | 3 'dart/core' |
4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
5 'dart/_js_helper' | 5 'dart/_js_helper' |
6 ], function(exports, dart, core, _js_helper) { | 6 ], function(exports, dart, core, _js_helper) { |
7 'use strict'; | 7 'use strict'; |
8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
9 class _JenkinsSmiHash extends core.Object { | 9 class _JenkinsSmiHash extends core.Object { |
10 static combine(hash, value) { | 10 static combine(hash, value) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ['=='](other) { | 45 ['=='](other) { |
46 if (!dart.is(other, Point$())) | 46 if (!dart.is(other, Point$())) |
47 return false; | 47 return false; |
48 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); | 48 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); |
49 } | 49 } |
50 get hashCode() { | 50 get hashCode() { |
51 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); | 51 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); |
52 } | 52 } |
53 ['+'](other) { | 53 ['+'](other) { |
54 dart.as(other, Point$(T)); | 54 dart.as(other, Point$(T)); |
55 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); | 55 return new (Point$(T))(dart.notNull(this.x) + dart.notNull(other.x), dar
t.notNull(this.y) + dart.notNull(other.y)); |
56 } | 56 } |
57 ['-'](other) { | 57 ['-'](other) { |
58 dart.as(other, Point$(T)); | 58 dart.as(other, Point$(T)); |
59 return new (Point$(T))(dart.as(this.x['-'](other.x), T), dart.as(this.y[
'-'](other.y), T)); | 59 return new (Point$(T))(dart.notNull(this.x) - dart.notNull(other.x), dar
t.notNull(this.y) - dart.notNull(other.y)); |
60 } | 60 } |
61 ['*'](factor) { | 61 ['*'](factor) { |
62 return new (Point$(T))(dart.as(this.x['*'](factor), T), dart.as(this.y['
*'](factor), T)); | 62 return new (Point$(T))(dart.notNull(this.x) * dart.notNull(factor), dart
.notNull(this.y) * dart.notNull(factor)); |
63 } | 63 } |
64 get magnitude() { | 64 get magnitude() { |
65 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*']
(this.y))); | 65 return sqrt(dart.notNull(this.x) * dart.notNull(this.x) + dart.notNull(t
his.y) * dart.notNull(this.y)); |
66 } | 66 } |
67 distanceTo(other) { | 67 distanceTo(other) { |
68 dart.as(other, Point$(T)); | 68 dart.as(other, Point$(T)); |
69 let dx = this.x['-'](other.x); | 69 let dx = dart.notNull(this.x) - dart.notNull(other.x); |
70 let dy = this.y['-'](other.y); | 70 let dy = dart.notNull(this.y) - dart.notNull(other.y); |
71 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar
t.notNull(dy)); | 71 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar
t.notNull(dy)); |
72 } | 72 } |
73 squaredDistanceTo(other) { | 73 squaredDistanceTo(other) { |
74 dart.as(other, Point$(T)); | 74 dart.as(other, Point$(T)); |
75 let dx = this.x['-'](other.x); | 75 let dx = dart.notNull(this.x) - dart.notNull(other.x); |
76 let dy = this.y['-'](other.y); | 76 let dy = dart.notNull(this.y) - dart.notNull(other.y); |
77 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) *
dart.notNull(dy), T); | 77 return dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.not
Null(dy); |
78 } | 78 } |
79 } | 79 } |
80 dart.setSignature(Point, { | 80 dart.setSignature(Point, { |
81 constructors: () => ({Point: [Point$(T), [T, T]]}), | 81 constructors: () => ({Point: [Point$(T), [T, T]]}), |
82 methods: () => ({ | 82 methods: () => ({ |
83 '+': [Point$(T), [Point$(T)]], | 83 '+': [Point$(T), [Point$(T)]], |
84 '-': [Point$(T), [Point$(T)]], | 84 '-': [Point$(T), [Point$(T)]], |
85 '*': [Point$(T), [core.num]], | 85 '*': [Point$(T), [core.num]], |
86 distanceTo: [core.double, [Point$(T)]], | 86 distanceTo: [core.double, [Point$(T)]], |
87 squaredDistanceTo: [T, [Point$(T)]] | 87 squaredDistanceTo: [T, [Point$(T)]] |
(...skipping 10 matching lines...) Expand all Loading... |
98 } | 98 } |
99 } | 99 } |
100 dart.setSignature(Random, { | 100 dart.setSignature(Random, { |
101 constructors: () => ({new: [Random, [], [core.int]]}) | 101 constructors: () => ({new: [Random, [], [core.int]]}) |
102 }); | 102 }); |
103 let _RectangleBase$ = dart.generic(function(T) { | 103 let _RectangleBase$ = dart.generic(function(T) { |
104 class _RectangleBase extends core.Object { | 104 class _RectangleBase extends core.Object { |
105 _RectangleBase() { | 105 _RectangleBase() { |
106 } | 106 } |
107 get right() { | 107 get right() { |
108 return dart.as(this.left['+'](this.width), T); | 108 return dart.notNull(this.left) + dart.notNull(this.width); |
109 } | 109 } |
110 get bottom() { | 110 get bottom() { |
111 return dart.as(this.top['+'](this.height), T); | 111 return dart.notNull(this.top) + dart.notNull(this.height); |
112 } | 112 } |
113 toString() { | 113 toString() { |
114 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; | 114 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; |
115 } | 115 } |
116 ['=='](other) { | 116 ['=='](other) { |
117 if (!dart.is(other, Rectangle)) | 117 if (!dart.is(other, Rectangle)) |
118 return false; | 118 return false; |
119 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); | 119 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); |
120 } | 120 } |
121 get hashCode() { | 121 get hashCode() { |
122 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); | 122 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); |
123 } | 123 } |
124 intersection(other) { | 124 intersection(other) { |
125 dart.as(other, Rectangle$(T)); | 125 dart.as(other, Rectangle$(T)); |
126 let x0 = max(this.left, other.left); | 126 let x0 = max(this.left, other.left); |
127 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); | 127 let x1 = min(dart.notNull(this.left) + dart.notNull(this.width), dart.no
tNull(other.left) + dart.notNull(other.width)); |
128 if (dart.notNull(x0) <= dart.notNull(x1)) { | 128 if (dart.notNull(x0) <= dart.notNull(x1)) { |
129 let y0 = max(this.top, other.top); | 129 let y0 = max(this.top, other.top); |
130 let y1 = min(this.top['+'](this.height), other.top['+'](other.height))
; | 130 let y1 = min(dart.notNull(this.top) + dart.notNull(this.height), dart.
notNull(other.top) + dart.notNull(other.height)); |
131 if (dart.notNull(y0) <= dart.notNull(y1)) { | 131 if (dart.notNull(y0) <= dart.notNull(y1)) { |
132 return new (Rectangle$(T))(dart.as(x0, T), dart.as(y0, T), dart.as(d
art.notNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(
y0), T)); | 132 return new (Rectangle$(T))(x0, y0, dart.notNull(x1) - dart.notNull(x
0), dart.notNull(y1) - dart.notNull(y0)); |
133 } | 133 } |
134 } | 134 } |
135 return null; | 135 return null; |
136 } | 136 } |
137 intersects(other) { | 137 intersects(other) { |
138 return dart.notNull(this.left['<='](dart.notNull(other.left) + dart.notN
ull(other.width))) && dart.notNull(other.left) <= dart.notNull(this.left['+'](th
is.width)) && dart.notNull(this.top['<='](dart.notNull(other.top) + dart.notNull
(other.height))) && dart.notNull(other.top) <= dart.notNull(this.top['+'](this.h
eight)); | 138 return dart.notNull(this.left) <= dart.notNull(other.left) + dart.notNul
l(other.width) && dart.notNull(other.left) <= dart.notNull(this.left) + dart.not
Null(this.width) && dart.notNull(this.top) <= dart.notNull(other.top) + dart.not
Null(other.height) && dart.notNull(other.top) <= dart.notNull(this.top) + dart.n
otNull(this.height); |
139 } | 139 } |
140 boundingBox(other) { | 140 boundingBox(other) { |
141 dart.as(other, Rectangle$(T)); | 141 dart.as(other, Rectangle$(T)); |
142 let right = max(this.left['+'](this.width), other.left['+'](other.width)
); | 142 let right = max(dart.notNull(this.left) + dart.notNull(this.width), dart
.notNull(other.left) + dart.notNull(other.width)); |
143 let bottom = max(this.top['+'](this.height), other.top['+'](other.height
)); | 143 let bottom = max(dart.notNull(this.top) + dart.notNull(this.height), dar
t.notNull(other.top) + dart.notNull(other.height)); |
144 let left = min(this.left, other.left); | 144 let left = min(this.left, other.left); |
145 let top = min(this.top, other.top); | 145 let top = min(this.top, other.top); |
146 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da
rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.
notNull(top), T)); | 146 return new (Rectangle$(T))(left, top, dart.notNull(right) - dart.notNull
(left), dart.notNull(bottom) - dart.notNull(top)); |
147 } | 147 } |
148 containsRectangle(another) { | 148 containsRectangle(another) { |
149 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this.
left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt
h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th
is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); | 149 return dart.notNull(this.left) <= dart.notNull(another.left) && dart.not
Null(this.left) + dart.notNull(this.width) >= dart.notNull(another.left) + dart.
notNull(another.width) && dart.notNull(this.top) <= dart.notNull(another.top) &&
dart.notNull(this.top) + dart.notNull(this.height) >= dart.notNull(another.top)
+ dart.notNull(another.height); |
150 } | 150 } |
151 containsPoint(another) { | 151 containsPoint(another) { |
152 return another.x[dartx['>=']](this.left) && dart.notNull(another.x) <= d
art.notNull(this.left['+'](this.width)) && another.y[dartx['>=']](this.top) && d
art.notNull(another.y) <= dart.notNull(this.top['+'](this.height)); | 152 return dart.notNull(another.x) >= dart.notNull(this.left) && dart.notNul
l(another.x) <= dart.notNull(this.left) + dart.notNull(this.width) && dart.notNu
ll(another.y) >= dart.notNull(this.top) && dart.notNull(another.y) <= dart.notNu
ll(this.top) + dart.notNull(this.height); |
153 } | 153 } |
154 get topLeft() { | 154 get topLeft() { |
155 return new (Point$(T))(this.left, this.top); | 155 return new (Point$(T))(this.left, this.top); |
156 } | 156 } |
157 get topRight() { | 157 get topRight() { |
158 return new (Point$(T))(dart.as(this.left['+'](this.width), T), this.top)
; | 158 return new (Point$(T))(dart.notNull(this.left) + dart.notNull(this.width
), this.top); |
159 } | 159 } |
160 get bottomRight() { | 160 get bottomRight() { |
161 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t
his.top['+'](this.height), T)); | 161 return new (Point$(T))(dart.notNull(this.left) + dart.notNull(this.width
), dart.notNull(this.top) + dart.notNull(this.height)); |
162 } | 162 } |
163 get bottomLeft() { | 163 get bottomLeft() { |
164 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T)
); | 164 return new (Point$(T))(this.left, dart.notNull(this.top) + dart.notNull(
this.height)); |
165 } | 165 } |
166 } | 166 } |
167 dart.setSignature(_RectangleBase, { | 167 dart.setSignature(_RectangleBase, { |
168 constructors: () => ({_RectangleBase: [_RectangleBase$(T), []]}), | 168 constructors: () => ({_RectangleBase: [_RectangleBase$(T), []]}), |
169 methods: () => ({ | 169 methods: () => ({ |
170 intersection: [Rectangle$(T), [Rectangle$(T)]], | 170 intersection: [Rectangle$(T), [Rectangle$(T)]], |
171 intersects: [core.bool, [Rectangle$(core.num)]], | 171 intersects: [core.bool, [Rectangle$(core.num)]], |
172 boundingBox: [Rectangle$(T), [Rectangle$(T)]], | 172 boundingBox: [Rectangle$(T), [Rectangle$(T)]], |
173 containsRectangle: [core.bool, [Rectangle$(core.num)]], | 173 containsRectangle: [core.bool, [Rectangle$(core.num)]], |
174 containsPoint: [core.bool, [Point$(core.num)]] | 174 containsPoint: [core.bool, [Point$(core.num)]] |
175 }) | 175 }) |
176 }); | 176 }); |
177 return _RectangleBase; | 177 return _RectangleBase; |
178 }); | 178 }); |
179 let _RectangleBase = _RectangleBase$(); | 179 let _RectangleBase = _RectangleBase$(); |
180 let Rectangle$ = dart.generic(function(T) { | 180 let Rectangle$ = dart.generic(function(T) { |
181 class Rectangle extends _RectangleBase$(T) { | 181 class Rectangle extends _RectangleBase$(T) { |
182 Rectangle(left, top, width, height) { | 182 Rectangle(left, top, width, height) { |
183 this.left = left; | 183 this.left = left; |
184 this.top = top; | 184 this.top = top; |
185 this.width = dart.as(dart.notNull(width['<'](0)) ? dart.notNull(width['u
nary-']()) * 0 : width, T); | 185 this.width = dart.notNull(width) < 0 ? -dart.notNull(width) * 0 : width; |
186 this.height = dart.as(dart.notNull(height['<'](0)) ? dart.notNull(height
['unary-']()) * 0 : height, T); | 186 this.height = dart.notNull(height) < 0 ? -dart.notNull(height) * 0 : hei
ght; |
187 super._RectangleBase(); | 187 super._RectangleBase(); |
188 } | 188 } |
189 static fromPoints(a, b) { | 189 static fromPoints(a, b) { |
190 let left = dart.as(min(a.x, b.x), T); | 190 let left = min(a.x, b.x); |
191 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 191 let width = dart.notNull(max(a.x, b.x)) - dart.notNull(left); |
192 let top = dart.as(min(a.y, b.y), T); | 192 let top = min(a.y, b.y); |
193 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 193 let height = dart.notNull(max(a.y, b.y)) - dart.notNull(top); |
194 return new (Rectangle$(T))(left, top, width, height); | 194 return new (Rectangle$(T))(left, top, width, height); |
195 } | 195 } |
196 } | 196 } |
197 dart.setSignature(Rectangle, { | 197 dart.setSignature(Rectangle, { |
198 constructors: () => ({ | 198 constructors: () => ({ |
199 Rectangle: [Rectangle$(T), [T, T, T, T]], | 199 Rectangle: [Rectangle$(T), [T, T, T, T]], |
200 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] | 200 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] |
201 }) | 201 }) |
202 }); | 202 }); |
203 return Rectangle; | 203 return Rectangle; |
204 }); | 204 }); |
205 let Rectangle = Rectangle$(); | 205 let Rectangle = Rectangle$(); |
206 let _width = Symbol('_width'); | 206 let _width = Symbol('_width'); |
207 let _height = Symbol('_height'); | 207 let _height = Symbol('_height'); |
208 let MutableRectangle$ = dart.generic(function(T) { | 208 let MutableRectangle$ = dart.generic(function(T) { |
209 class MutableRectangle extends _RectangleBase$(T) { | 209 class MutableRectangle extends _RectangleBase$(T) { |
210 MutableRectangle(left, top, width, height) { | 210 MutableRectangle(left, top, width, height) { |
211 this.left = left; | 211 this.left = left; |
212 this.top = top; | 212 this.top = top; |
213 this[_width] = dart.as(dart.notNull(width['<'](0)) ? _clampToZero(width)
: width, T); | 213 this[_width] = dart.notNull(width) < 0 ? _clampToZero(width) : width; |
214 this[_height] = dart.as(dart.notNull(height['<'](0)) ? _clampToZero(heig
ht) : height, T); | 214 this[_height] = dart.notNull(height) < 0 ? _clampToZero(height) : height
; |
215 super._RectangleBase(); | 215 super._RectangleBase(); |
216 } | 216 } |
217 static fromPoints(a, b) { | 217 static fromPoints(a, b) { |
218 let left = dart.as(min(a.x, b.x), T); | 218 let left = min(a.x, b.x); |
219 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 219 let width = dart.notNull(max(a.x, b.x)) - dart.notNull(left); |
220 let top = dart.as(min(a.y, b.y), T); | 220 let top = min(a.y, b.y); |
221 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 221 let height = dart.notNull(max(a.y, b.y)) - dart.notNull(top); |
222 return new (MutableRectangle$(T))(left, top, width, height); | 222 return new (MutableRectangle$(T))(left, top, width, height); |
223 } | 223 } |
224 get width() { | 224 get width() { |
225 return this[_width]; | 225 return this[_width]; |
226 } | 226 } |
227 set width(width) { | 227 set width(width) { |
228 dart.as(width, T); | 228 dart.as(width, T); |
229 if (dart.notNull(width['<'](0))) | 229 if (dart.notNull(width) < 0) |
230 width = dart.as(_clampToZero(width), T); | 230 width = _clampToZero(width); |
231 this[_width] = width; | 231 this[_width] = width; |
232 } | 232 } |
233 get height() { | 233 get height() { |
234 return this[_height]; | 234 return this[_height]; |
235 } | 235 } |
236 set height(height) { | 236 set height(height) { |
237 dart.as(height, T); | 237 dart.as(height, T); |
238 if (dart.notNull(height['<'](0))) | 238 if (dart.notNull(height) < 0) |
239 height = dart.as(_clampToZero(height), T); | 239 height = _clampToZero(height); |
240 this[_height] = height; | 240 this[_height] = height; |
241 } | 241 } |
242 } | 242 } |
243 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; | 243 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; |
244 dart.setSignature(MutableRectangle, { | 244 dart.setSignature(MutableRectangle, { |
245 constructors: () => ({ | 245 constructors: () => ({ |
246 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], | 246 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], |
247 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] | 247 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] |
248 }) | 248 }) |
249 }); | 249 }); |
250 return MutableRectangle; | 250 return MutableRectangle; |
251 }); | 251 }); |
252 let MutableRectangle = MutableRectangle$(); | 252 let MutableRectangle = MutableRectangle$(); |
253 function _clampToZero(value) { | 253 function _clampToZero(value) { |
254 dart.assert(dart.notNull(value) < 0); | 254 dart.assert(dart.notNull(value) < 0); |
255 return -dart.notNull(value) * 0; | 255 return -dart.notNull(value) * 0; |
256 } | 256 } |
257 dart.fn(_clampToZero, core.num, [core.num]); | 257 dart.fn(_clampToZero, core.num, [core.num]); |
258 let E = 2.718281828459045; | 258 let E = 2.718281828459045; |
259 let LN10 = 2.302585092994046; | 259 let LN10 = 2.302585092994046; |
260 let LN2 = 0.6931471805599453; | 260 let LN2 = 0.6931471805599453; |
261 let LOG2E = 1.4426950408889634; | 261 let LOG2E = 1.4426950408889634; |
262 let LOG10E = 0.4342944819032518; | 262 let LOG10E = 0.4342944819032518; |
263 let PI = 3.141592653589793; | 263 let PI = 3.141592653589793; |
264 let SQRT1_2 = 0.7071067811865476; | 264 let SQRT1_2 = 0.7071067811865476; |
265 let SQRT2 = 1.4142135623730951; | 265 let SQRT2 = 1.4142135623730951; |
266 function min(a, b) { | 266 function min(a, b) { |
267 if (!dart.is(a, core.num)) | 267 if (!(typeof a == 'number')) |
268 dart.throw(new core.ArgumentError(a)); | 268 dart.throw(new core.ArgumentError(a)); |
269 if (!dart.is(b, core.num)) | 269 if (!(typeof b == 'number')) |
270 dart.throw(new core.ArgumentError(b)); | 270 dart.throw(new core.ArgumentError(b)); |
271 if (dart.notNull(a) > dart.notNull(b)) | 271 if (dart.notNull(a) > dart.notNull(b)) |
272 return b; | 272 return b; |
273 if (dart.notNull(a) < dart.notNull(b)) | 273 if (dart.notNull(a) < dart.notNull(b)) |
274 return a; | 274 return a; |
275 if (typeof b == 'number') { | 275 if (typeof b == 'number') { |
276 if (typeof a == 'number') { | 276 if (typeof a == 'number') { |
277 if (a == 0.0) { | 277 if (a == 0.0) { |
278 return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.no
tNull(b); | 278 return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.no
tNull(b); |
279 } | 279 } |
280 } | 280 } |
281 if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.is
NaN])) | 281 if (a == 0 && dart.notNull(b[dartx.isNegative]) || dart.notNull(b[dartx.is
NaN])) |
282 return b; | 282 return b; |
283 return a; | 283 return a; |
284 } | 284 } |
285 return a; | 285 return a; |
286 } | 286 } |
287 dart.fn(min, core.num, [core.num, core.num]); | 287 dart.fn(min, core.num, [core.num, core.num]); |
288 function max(a, b) { | 288 function max(a, b) { |
289 if (!dart.is(a, core.num)) | 289 if (!(typeof a == 'number')) |
290 dart.throw(new core.ArgumentError(a)); | 290 dart.throw(new core.ArgumentError(a)); |
291 if (!dart.is(b, core.num)) | 291 if (!(typeof b == 'number')) |
292 dart.throw(new core.ArgumentError(b)); | 292 dart.throw(new core.ArgumentError(b)); |
293 if (dart.notNull(a) > dart.notNull(b)) | 293 if (dart.notNull(a) > dart.notNull(b)) |
294 return a; | 294 return a; |
295 if (dart.notNull(a) < dart.notNull(b)) | 295 if (dart.notNull(a) < dart.notNull(b)) |
296 return b; | 296 return b; |
297 if (typeof b == 'number') { | 297 if (typeof b == 'number') { |
298 if (typeof a == 'number') { | 298 if (typeof a == 'number') { |
299 if (a == 0.0) { | 299 if (a == 0.0) { |
300 return dart.notNull(a) + dart.notNull(b); | 300 return dart.notNull(a) + dart.notNull(b); |
301 } | 301 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 459 } |
460 if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) { | 460 if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) { |
461 this[_nextState](); | 461 this[_nextState](); |
462 return dart.notNull(this[_lo]) & dart.notNull(max) - 1; | 462 return dart.notNull(this[_lo]) & dart.notNull(max) - 1; |
463 } | 463 } |
464 let rnd32 = null; | 464 let rnd32 = null; |
465 let result = null; | 465 let result = null; |
466 do { | 466 do { |
467 this[_nextState](); | 467 this[_nextState](); |
468 rnd32 = this[_lo]; | 468 rnd32 = this[_lo]; |
469 result = rnd32[dartx.remainder](max); | 469 result = dart.asInt(rnd32[dartx.remainder](max)); |
470 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >=
dart.notNull(_POW2_32)); | 470 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >=
dart.notNull(_POW2_32)); |
471 return result; | 471 return result; |
472 } | 472 } |
473 nextDouble() { | 473 nextDouble() { |
474 this[_nextState](); | 474 this[_nextState](); |
475 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1; | 475 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1; |
476 this[_nextState](); | 476 this[_nextState](); |
477 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; | 477 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; |
478 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not
Null(bits27)) / dart.notNull(_Random._POW2_53_D); | 478 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not
Null(bits27)) / dart.notNull(_Random._POW2_53_D); |
479 } | 479 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 exports.sin = sin; | 518 exports.sin = sin; |
519 exports.cos = cos; | 519 exports.cos = cos; |
520 exports.tan = tan; | 520 exports.tan = tan; |
521 exports.acos = acos; | 521 exports.acos = acos; |
522 exports.asin = asin; | 522 exports.asin = asin; |
523 exports.atan = atan; | 523 exports.atan = atan; |
524 exports.sqrt = sqrt; | 524 exports.sqrt = sqrt; |
525 exports.exp = exp; | 525 exports.exp = exp; |
526 exports.log = log; | 526 exports.log = log; |
527 }); | 527 }); |
OLD | NEW |