| Index: test/dart_codegen/expect/math/math
|
| diff --git a/test/dart_codegen/expect/math/math b/test/dart_codegen/expect/math/math
|
| index c410873645cf35c503184a228b3535c84279a14f..f80cc5ccff9d7820b6a4f79eacede20b656e73c7 100644
|
| --- a/test/dart_codegen/expect/math/math
|
| +++ b/test/dart_codegen/expect/math/math
|
| @@ -1,207 +1,171 @@
|
| library dart.math;
|
| -
|
| import 'package:dev_compiler/runtime/dart_logging_runtime.dart' as DDC$RT;
|
| part "jenkins_smi_hash.dart";
|
| -part "point.dart";
|
| -part "random.dart";
|
| -part "rectangle.dart";
|
| -
|
| -const double E = 2.718281828459045;
|
| -const double LN10 = 2.302585092994046;
|
| -const double LN2 = 0.6931471805599453;
|
| -const double LOG2E = 1.4426950408889634;
|
| -const double LOG10E = 0.4342944819032518;
|
| -const double PI = 3.1415926535897932;
|
| -const double SQRT1_2 = 0.7071067811865476;
|
| -const double SQRT2 = 1.4142135623730951;
|
| -num min(num a, num b) {
|
| + part "point.dart";
|
| + part "random.dart";
|
| + part "rectangle.dart";
|
| + const double E = 2.718281828459045;
|
| + const double LN10 = 2.302585092994046;
|
| + const double LN2 = 0.6931471805599453;
|
| + const double LOG2E = 1.4426950408889634;
|
| + const double LOG10E = 0.4342944819032518;
|
| + const double PI = 3.1415926535897932;
|
| + const double SQRT1_2 = 0.7071067811865476;
|
| + const double SQRT2 = 1.4142135623730951;
|
| + num min(num a, num b) {
|
| if (a is! num) throw new ArgumentError(a);
|
| - if (b is! num) throw new ArgumentError(b);
|
| - if (a > b) return b;
|
| - if (a < b) return a;
|
| - if (b is double) {
|
| + if (b is! num) throw new ArgumentError(b);
|
| + if (a > b) return b;
|
| + if (a < b) return a;
|
| + if (b is double) {
|
| if (a is double) {
|
| if (a == 0.0) {
|
| return (a + b) * a * b;
|
| + }
|
| }
|
| + if (a == 0 && b.isNegative || b.isNaN) return b;
|
| + return a;
|
| }
|
| - if (a == 0 && b.isNegative || b.isNaN) return b;
|
| - return a;
|
| + return a;
|
| }
|
| - return a;
|
| -}
|
| -num max(num a, num b) {
|
| + num max(num a, num b) {
|
| if (a is! num) throw new ArgumentError(a);
|
| - if (b is! num) throw new ArgumentError(b);
|
| - if (a > b) return a;
|
| - if (a < b) return b;
|
| - if (b is double) {
|
| + if (b is! num) throw new ArgumentError(b);
|
| + if (a > b) return a;
|
| + if (a < b) return b;
|
| + if (b is double) {
|
| if (a is double) {
|
| if (a == 0.0) {
|
| return a + b;
|
| + }
|
| }
|
| + if (b.isNaN) return b;
|
| + return a;
|
| }
|
| - if (b.isNaN) return b;
|
| - return a;
|
| + if (b == 0 && a.isNegative) return b;
|
| + return a;
|
| }
|
| - if (b == 0 && a.isNegative) return b;
|
| - return a;
|
| -}
|
| -double atan2(num a, num b) => ((__x13) => DDC$RT.cast(__x13, dynamic, double,
|
| - "CastGeneral", """line 150, column 6 of dart:math: """, __x13 is double,
|
| - true))(JS('double', r'Math.atan2(#, #)', checkNum(a), checkNum(b)));
|
| -num pow(num x, num exponent) {
|
| + double atan2(num a, num b) => ((__x13) => DDC$RT.cast(__x13, dynamic, double, "CastGeneral", """line 150, column 6 of dart:math: """, __x13 is double, true))(JS('double', r'Math.atan2(#, #)', checkNum(a), checkNum(b)));
|
| + num pow(num x, num exponent) {
|
| checkNum(x);
|
| - checkNum(exponent);
|
| - return ((__x14) => DDC$RT.cast(__x14, dynamic, num, "CastGeneral",
|
| - """line 192, column 10 of dart:math: """, __x14 is num,
|
| - true))(JS('num', r'Math.pow(#, #)', x, exponent));
|
| -}
|
| -double sin(num x) => ((__x15) => DDC$RT.cast(__x15, dynamic, double,
|
| - "CastGeneral", """line 201, column 6 of dart:math: """, __x15 is double,
|
| - true))(JS('double', r'Math.sin(#)', checkNum(x)));
|
| -double cos(num x) => ((__x16) => DDC$RT.cast(__x16, dynamic, double,
|
| - "CastGeneral", """line 209, column 6 of dart:math: """, __x16 is double,
|
| - true))(JS('double', r'Math.cos(#)', checkNum(x)));
|
| -double tan(num x) => ((__x17) => DDC$RT.cast(__x17, dynamic, double,
|
| - "CastGeneral", """line 219, column 6 of dart:math: """, __x17 is double,
|
| - true))(JS('double', r'Math.tan(#)', checkNum(x)));
|
| -double acos(num x) => ((__x18) => DDC$RT.cast(__x18, dynamic, double,
|
| - "CastGeneral", """line 228, column 6 of dart:math: """, __x18 is double,
|
| - true))(JS('double', r'Math.acos(#)', checkNum(x)));
|
| -double asin(num x) => ((__x19) => DDC$RT.cast(__x19, dynamic, double,
|
| - "CastGeneral", """line 236, column 6 of dart:math: """, __x19 is double,
|
| - true))(JS('double', r'Math.asin(#)', checkNum(x)));
|
| -double atan(num x) => ((__x20) => DDC$RT.cast(__x20, dynamic, double,
|
| - "CastGeneral", """line 243, column 6 of dart:math: """, __x20 is double,
|
| - true))(JS('double', r'Math.atan(#)', checkNum(x)));
|
| -double sqrt(num x) => ((__x21) => DDC$RT.cast(__x21, dynamic, double,
|
| - "CastGeneral", """line 251, column 6 of dart:math: """, __x21 is double,
|
| - true))(JS('double', r'Math.sqrt(#)', checkNum(x)));
|
| -double exp(num x) => ((__x22) => DDC$RT.cast(__x22, dynamic, double,
|
| - "CastGeneral", """line 259, column 6 of dart:math: """, __x22 is double,
|
| - true))(JS('double', r'Math.exp(#)', checkNum(x)));
|
| -double log(num x) => ((__x23) => DDC$RT.cast(__x23, dynamic, double,
|
| - "CastGeneral", """line 267, column 6 of dart:math: """, __x23 is double,
|
| - true))(JS('double', r'Math.log(#)', checkNum(x)));
|
| -const int _POW2_32 = 0x100000000;
|
| -class _JSRandom implements Random {
|
| - const _JSRandom();
|
| - int nextInt(int max) {
|
| - if (max <= 0 || max > _POW2_32) {
|
| - throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
|
| + checkNum(exponent);
|
| + return ((__x14) => DDC$RT.cast(__x14, dynamic, num, "CastGeneral", """line 192, column 10 of dart:math: """, __x14 is num, true))(JS('num', r'Math.pow(#, #)', x, exponent));
|
| + }
|
| + double sin(num x) => ((__x15) => DDC$RT.cast(__x15, dynamic, double, "CastGeneral", """line 201, column 6 of dart:math: """, __x15 is double, true))(JS('double', r'Math.sin(#)', checkNum(x)));
|
| + double cos(num x) => ((__x16) => DDC$RT.cast(__x16, dynamic, double, "CastGeneral", """line 209, column 6 of dart:math: """, __x16 is double, true))(JS('double', r'Math.cos(#)', checkNum(x)));
|
| + double tan(num x) => ((__x17) => DDC$RT.cast(__x17, dynamic, double, "CastGeneral", """line 219, column 6 of dart:math: """, __x17 is double, true))(JS('double', r'Math.tan(#)', checkNum(x)));
|
| + double acos(num x) => ((__x18) => DDC$RT.cast(__x18, dynamic, double, "CastGeneral", """line 228, column 6 of dart:math: """, __x18 is double, true))(JS('double', r'Math.acos(#)', checkNum(x)));
|
| + double asin(num x) => ((__x19) => DDC$RT.cast(__x19, dynamic, double, "CastGeneral", """line 236, column 6 of dart:math: """, __x19 is double, true))(JS('double', r'Math.asin(#)', checkNum(x)));
|
| + double atan(num x) => ((__x20) => DDC$RT.cast(__x20, dynamic, double, "CastGeneral", """line 243, column 6 of dart:math: """, __x20 is double, true))(JS('double', r'Math.atan(#)', checkNum(x)));
|
| + double sqrt(num x) => ((__x21) => DDC$RT.cast(__x21, dynamic, double, "CastGeneral", """line 251, column 6 of dart:math: """, __x21 is double, true))(JS('double', r'Math.sqrt(#)', checkNum(x)));
|
| + double exp(num x) => ((__x22) => DDC$RT.cast(__x22, dynamic, double, "CastGeneral", """line 259, column 6 of dart:math: """, __x22 is double, true))(JS('double', r'Math.exp(#)', checkNum(x)));
|
| + double log(num x) => ((__x23) => DDC$RT.cast(__x23, dynamic, double, "CastGeneral", """line 267, column 6 of dart:math: """, __x23 is double, true))(JS('double', r'Math.log(#)', checkNum(x)));
|
| + const int _POW2_32 = 0x100000000;
|
| + class _JSRandom implements Random {const _JSRandom();
|
| + int nextInt(int max) {
|
| + if (max <= 0 || max > _POW2_32) {
|
| + throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
|
| }
|
| - return ((__x24) => DDC$RT.cast(__x24, dynamic, int, "CastGeneral",
|
| - """line 278, column 12 of dart:math: """, __x24 is int,
|
| - true))(JS("int", "(Math.random() * #) >>> 0", max));
|
| + return ((__x24) => DDC$RT.cast(__x24, dynamic, int, "CastGeneral", """line 278, column 12 of dart:math: """, __x24 is int, true))(JS("int", "(Math.random() * #) >>> 0", max));
|
| }
|
| - double nextDouble() => ((__x25) => DDC$RT.cast(__x25, dynamic, double,
|
| - "CastGeneral", """line 285, column 26 of dart:math: """, __x25 is double,
|
| - true))(JS("double", "Math.random()"));
|
| - bool nextBool() => ((__x26) => DDC$RT.cast(__x26, dynamic, bool,
|
| - "CastGeneral", """line 290, column 22 of dart:math: """, __x26 is bool,
|
| - true))(JS("bool", "Math.random() < 0.5"));
|
| + double nextDouble() => ((__x25) => DDC$RT.cast(__x25, dynamic, double, "CastGeneral", """line 285, column 26 of dart:math: """, __x25 is double, true))(JS("double", "Math.random()"));
|
| + bool nextBool() => ((__x26) => DDC$RT.cast(__x26, dynamic, bool, "CastGeneral", """line 290, column 22 of dart:math: """, __x26 is bool, true))(JS("bool", "Math.random() < 0.5"));
|
| }
|
| -class _Random implements Random {
|
| - static const double _POW2_53_D = 1.0 * (0x20000000000000);
|
| - static const double _POW2_27_D = 1.0 * (1 << 27);
|
| - static const int _MASK32 = 0xFFFFFFFF;
|
| - int _lo = 0;
|
| - int _hi = 0;
|
| - _Random(int seed) {
|
| - int empty_seed = 0;
|
| - if (seed < 0) {
|
| - empty_seed = -1;
|
| - }
|
| - do {
|
| - int low = seed & _MASK32;
|
| - seed = (seed - low) ~/ _POW2_32;
|
| - int high = seed & _MASK32;
|
| - seed = (seed - high) ~/ _POW2_32;
|
| - int tmplow = low << 21;
|
| - int tmphigh = (high << 21) | (low >> 11);
|
| - tmplow = (~low & _MASK32) + tmplow;
|
| - low = tmplow & _MASK32;
|
| - high = (~high + tmphigh + ((tmplow - low) ~/ 0x100000000)) & _MASK32;
|
| - tmphigh = high >> 24;
|
| - tmplow = (low >> 24) | (high << 8);
|
| - low ^= tmplow;
|
| - high ^= tmphigh;
|
| - tmplow = low * 265;
|
| - low = tmplow & _MASK32;
|
| - high = (high * 265 + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| - tmphigh = high >> 14;
|
| - tmplow = (low >> 14) | (high << 18);
|
| - low ^= tmplow;
|
| - high ^= tmphigh;
|
| - tmplow = low * 21;
|
| - low = tmplow & _MASK32;
|
| - high = (high * 21 + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| - tmphigh = high >> 28;
|
| - tmplow = (low >> 28) | (high << 4);
|
| - low ^= tmplow;
|
| - high ^= tmphigh;
|
| - tmplow = low << 31;
|
| - tmphigh = (high << 31) | (low >> 1);
|
| - tmplow += low;
|
| - low = tmplow & _MASK32;
|
| - high = (high + tmphigh + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| - tmplow = _lo * 1037;
|
| - _lo = tmplow & _MASK32;
|
| - _hi = (_hi * 1037 + (tmplow - _lo) ~/ 0x100000000) & _MASK32;
|
| - _lo ^= low;
|
| - _hi ^= high;
|
| - } while (seed != empty_seed);
|
| - if (_hi == 0 && _lo == 0) {
|
| - _lo = 0x5A17;
|
| - }
|
| - _nextState();
|
| - _nextState();
|
| - _nextState();
|
| - _nextState();
|
| + class _Random implements Random {static const double _POW2_53_D = 1.0 * (0x20000000000000);
|
| + static const double _POW2_27_D = 1.0 * (1 << 27);
|
| + static const int _MASK32 = 0xFFFFFFFF;
|
| + int _lo = 0;
|
| + int _hi = 0;
|
| + _Random(int seed) {
|
| +int empty_seed = 0;
|
| + if (seed < 0) {
|
| + empty_seed = -1;
|
| }
|
| - void _nextState() {
|
| - int tmpHi = 0xFFFF0000 * _lo;
|
| - int tmpHiLo = tmpHi & _MASK32;
|
| - int tmpHiHi = tmpHi - tmpHiLo;
|
| - int tmpLo = 0xDA61 * _lo;
|
| - int tmpLoLo = tmpLo & _MASK32;
|
| - int tmpLoHi = tmpLo - tmpLoLo;
|
| - int newLo = tmpLoLo + tmpHiLo + _hi;
|
| - _lo = newLo & _MASK32;
|
| - int newLoHi = newLo - _lo;
|
| - _hi = ((tmpLoHi + tmpHiHi + newLoHi) ~/ _POW2_32) & _MASK32;
|
| - assert(_lo < _POW2_32);
|
| - assert(_hi < _POW2_32);
|
| + do {
|
| + int low = seed & _MASK32;
|
| + seed = (seed - low) ~/ _POW2_32;
|
| + int high = seed & _MASK32;
|
| + seed = (seed - high) ~/ _POW2_32;
|
| + int tmplow = low << 21;
|
| + int tmphigh = (high << 21) | (low >> 11);
|
| + tmplow = (~low & _MASK32) + tmplow;
|
| + low = tmplow & _MASK32;
|
| + high = (~high + tmphigh + ((tmplow - low) ~/ 0x100000000)) & _MASK32;
|
| + tmphigh = high >> 24;
|
| + tmplow = (low >> 24) | (high << 8);
|
| + low ^= tmplow;
|
| + high ^= tmphigh;
|
| + tmplow = low * 265;
|
| + low = tmplow & _MASK32;
|
| + high = (high * 265 + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| + tmphigh = high >> 14;
|
| + tmplow = (low >> 14) | (high << 18);
|
| + low ^= tmplow;
|
| + high ^= tmphigh;
|
| + tmplow = low * 21;
|
| + low = tmplow & _MASK32;
|
| + high = (high * 21 + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| + tmphigh = high >> 28;
|
| + tmplow = (low >> 28) | (high << 4);
|
| + low ^= tmplow;
|
| + high ^= tmphigh;
|
| + tmplow = low << 31;
|
| + tmphigh = (high << 31) | (low >> 1);
|
| + tmplow += low;
|
| + low = tmplow & _MASK32;
|
| + high = (high + tmphigh + (tmplow - low) ~/ 0x100000000) & _MASK32;
|
| + tmplow = _lo * 1037;
|
| + _lo = tmplow & _MASK32;
|
| + _hi = (_hi * 1037 + (tmplow - _lo) ~/ 0x100000000) & _MASK32;
|
| + _lo ^= low;
|
| + _hi ^= high;
|
| }
|
| - int nextInt(int max) {
|
| - if (max <= 0 || max > _POW2_32) {
|
| - throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
|
| - }
|
| - if ((max & (max - 1)) == 0) {
|
| - _nextState();
|
| - return _lo & (max - 1);
|
| - }
|
| - int rnd32;
|
| - int result;
|
| - do {
|
| - _nextState();
|
| - rnd32 = _lo;
|
| - result = ((__x27) => DDC$RT.cast(__x27, num, int, "CastGeneral",
|
| - """line 424, column 16 of dart:math: """, __x27 is int,
|
| - true))(rnd32.remainder(max));
|
| - } while ((rnd32 - result + max) >= _POW2_32);
|
| - return result;
|
| + while (seed != empty_seed); if (_hi == 0 && _lo == 0) {
|
| + _lo = 0x5A17;
|
| + }
|
| + _nextState();
|
| + _nextState();
|
| + _nextState();
|
| + _nextState();
|
| +}
|
| + void _nextState() {
|
| +int tmpHi = 0xFFFF0000 * _lo;
|
| + int tmpHiLo = tmpHi & _MASK32;
|
| + int tmpHiHi = tmpHi - tmpHiLo;
|
| + int tmpLo = 0xDA61 * _lo;
|
| + int tmpLoLo = tmpLo & _MASK32;
|
| + int tmpLoHi = tmpLo - tmpLoLo;
|
| + int newLo = tmpLoLo + tmpHiLo + _hi;
|
| + _lo = newLo & _MASK32;
|
| + int newLoHi = newLo - _lo;
|
| + _hi = ((tmpLoHi + tmpHiHi + newLoHi) ~/ _POW2_32) & _MASK32;
|
| + assert (_lo < _POW2_32); assert (_hi < _POW2_32);}
|
| + int nextInt(int max) {
|
| +if (max <= 0 || max > _POW2_32) {
|
| + throw new RangeError("max must be in range 0 < max ≤ 2^32, was $max");
|
| }
|
| - double nextDouble() {
|
| - _nextState();
|
| - int bits26 = _lo & ((1 << 26) - 1);
|
| - _nextState();
|
| - int bits27 = _lo & ((1 << 27) - 1);
|
| - return (bits26 * _POW2_27_D + bits27) / _POW2_53_D;
|
| + if ((max & (max - 1)) == 0) {
|
| + _nextState();
|
| + return _lo & (max - 1);
|
| }
|
| - bool nextBool() {
|
| - _nextState();
|
| - return (_lo & 1) == 0;
|
| + int rnd32;
|
| + int result;
|
| + do {
|
| + _nextState();
|
| + rnd32 = _lo;
|
| + result = ((__x27) => DDC$RT.cast(__x27, num, int, "CastGeneral", """line 424, column 16 of dart:math: """, __x27 is int, true))(rnd32.remainder(max));
|
| }
|
| + while ((rnd32 - result + max) >= _POW2_32); return result;
|
| +}
|
| + double nextDouble() {
|
| +_nextState();
|
| + int bits26 = _lo & ((1 << 26) - 1);
|
| + _nextState();
|
| + int bits27 = _lo & ((1 << 27) - 1);
|
| + return (bits26 * _POW2_27_D + bits27) / _POW2_53_D;
|
| +}
|
| + bool nextBool() {
|
| +_nextState();
|
| + return (_lo & 1) == 0;
|
| +}
|
| }
|
|
|