| 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 import "dart:typed_data"; | 5 import "dart:typed_data"; |
| 6 | 6 |
| 7 // A VM patch of the dart:math library. | 7 // A VM patch of the dart:math library. |
| 8 | 8 |
| 9 // If [x] is an [int] and [exponent] is a non-negative [int], the result is | 9 // If [x] is an [int] and [exponent] is a non-negative [int], the result is |
| 10 // an [int], otherwise the result is a [double]. | 10 // an [int], otherwise the result is a [double]. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (exponent != 0) { | 53 if (exponent != 0) { |
| 54 base *= base; | 54 base *= base; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 return result; | 57 return result; |
| 58 } | 58 } |
| 59 | 59 |
| 60 @patch | 60 @patch |
| 61 double atan2(num a, num b) => _atan2(a.toDouble(), b.toDouble()); | 61 double atan2(num a, num b) => _atan2(a.toDouble(), b.toDouble()); |
| 62 @patch | 62 @patch |
| 63 double sin(num x) => _sin(x.toDouble()); | 63 double sin(num radians) => _sin(radians.toDouble()); |
| 64 @patch | 64 @patch |
| 65 double cos(num x) => _cos(x.toDouble()); | 65 double cos(num radians) => _cos(radians.toDouble()); |
| 66 @patch | 66 @patch |
| 67 double tan(num x) => _tan(x.toDouble()); | 67 double tan(num radians) => _tan(radians.toDouble()); |
| 68 @patch | 68 @patch |
| 69 double acos(num x) => _acos(x.toDouble()); | 69 double acos(num x) => _acos(x.toDouble()); |
| 70 @patch | 70 @patch |
| 71 double asin(num x) => _asin(x.toDouble()); | 71 double asin(num x) => _asin(x.toDouble()); |
| 72 @patch | 72 @patch |
| 73 double atan(num x) => _atan(x.toDouble()); | 73 double atan(num x) => _atan(x.toDouble()); |
| 74 @patch | 74 @patch |
| 75 double sqrt(num x) => _sqrt(x.toDouble()); | 75 double sqrt(num x) => _sqrt(x.toDouble()); |
| 76 @patch | 76 @patch |
| 77 double exp(num x) => _exp(x.toDouble()); | 77 double exp(num x) => _exp(x.toDouble()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool nextBool() { | 217 bool nextBool() { |
| 218 return _getBytes(1).isEven; | 218 return _getBytes(1).isEven; |
| 219 } | 219 } |
| 220 | 220 |
| 221 // Constants used by the algorithm. | 221 // Constants used by the algorithm. |
| 222 static const _POW2_32 = 1 << 32; | 222 static const _POW2_32 = 1 << 32; |
| 223 static const _POW2_53_D = 1.0 * (1 << 53); | 223 static const _POW2_53_D = 1.0 * (1 << 53); |
| 224 } | 224 } |
| OLD | NEW |