OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'dart:fletch._system' as fletch; | 5 import 'dart:dartino._system' as dartino; |
6 import 'dart:fletch._system' show patch; | 6 import 'dart:dartino._system' show patch; |
7 | 7 |
8 @patch class Random { | 8 @patch class Random { |
9 @patch factory Random([int seed]) { | 9 @patch factory Random([int seed]) { |
10 return new _Random(seed); | 10 return new _Random(seed); |
11 } | 11 } |
12 } | 12 } |
13 | 13 |
14 | 14 |
15 // Implements the same XorShift+ algorithm as random.h. Splits 64 bit values | 15 // Implements the same XorShift+ algorithm as random.h. Splits 64 bit values |
16 // into three 23 bit parts, in order to keep everything in smis. | 16 // into three 23 bit parts, in order to keep everything in smis. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 exponent >>= 1; | 198 exponent >>= 1; |
199 // Skip unnecessary operation (can overflow to Mint or Bigint). | 199 // Skip unnecessary operation (can overflow to Mint or Bigint). |
200 if (exponent != 0) { | 200 if (exponent != 0) { |
201 base *= base; | 201 base *= base; |
202 } | 202 } |
203 } | 203 } |
204 return result; | 204 return result; |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 @fletch.native external double _sin(double x); | 208 @dartino.native external double _sin(double x); |
209 | 209 |
210 @fletch.native external double _cos(double x); | 210 @dartino.native external double _cos(double x); |
211 | 211 |
212 @fletch.native external double _tan(double x); | 212 @dartino.native external double _tan(double x); |
213 | 213 |
214 @fletch.native external double _acos(double x); | 214 @dartino.native external double _acos(double x); |
215 | 215 |
216 @fletch.native external double _asin(double x); | 216 @dartino.native external double _asin(double x); |
217 | 217 |
218 @fletch.native external double _atan(double x); | 218 @dartino.native external double _atan(double x); |
219 | 219 |
220 @fletch.native external double _sqrt(double x); | 220 @dartino.native external double _sqrt(double x); |
221 | 221 |
222 @fletch.native external double _exp(double x); | 222 @dartino.native external double _exp(double x); |
223 | 223 |
224 @fletch.native external double _log(double x); | 224 @dartino.native external double _log(double x); |
225 | 225 |
226 @fletch.native external double _atan2(double a, double b); | 226 @dartino.native external double _atan2(double a, double b); |
227 | 227 |
228 @fletch.native external double _pow(double x, double exponent); | 228 @dartino.native external double _pow(double x, double exponent); |
OLD | NEW |