| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 main() { | 5 main() { |
| 6 Expect.equals(0, 0.0.round()); | 6 Expect.equals(0, 0.0.round()); |
| 7 Expect.equals(0, double.MIN_POSITIVE.round()); | 7 Expect.equals(0, double.MIN_POSITIVE.round()); |
| 8 Expect.equals(0, (2.0 * double.MIN_POSITIVE).round()); | 8 Expect.equals(0, (2.0 * double.MIN_POSITIVE).round()); |
| 9 Expect.equals(0, (1.18e-38).round()); | 9 Expect.equals(0, (1.18e-38).round()); |
| 10 Expect.equals(0, (1.18e-38 * 2).round()); | 10 Expect.equals(0, (1.18e-38 * 2).round()); |
| 11 Expect.equals(1, 0.5.round()); | 11 Expect.equals(1, 0.5.round()); |
| 12 Expect.equals(1, 0.9999999999999999.round()); | 12 Expect.equals(1, 0.9999999999999999.round()); |
| 13 Expect.equals(1, 1.0.round()); | 13 Expect.equals(1, 1.0.round()); |
| 14 Expect.equals(1, 1.000000000000001.round()); | 14 Expect.equals(1, 1.000000000000001.round()); |
| 15 | 15 |
| 16 Expect.equals(9007199254740991, 9007199254740991.0.round()); | |
| 17 Expect.equals(9007199254740992, 9007199254740992.0.round()); | |
| 18 Expect.equals(1797693134862315708145274237317043567980705675258449965989174768
03157260780028538760589558632766878171540458953514382464234321326889464182768467
54670353751698604991057655128207624549009038932894407586850845513394230458323690
32229481658085593321233482747978262041447231687381771809192998812504040261841248
58368, | 16 Expect.equals(1797693134862315708145274237317043567980705675258449965989174768
03157260780028538760589558632766878171540458953514382464234321326889464182768467
54670353751698604991057655128207624549009038932894407586850845513394230458323690
32229481658085593321233482747978262041447231687381771809192998812504040261841248
58368, |
| 19 double.MAX_FINITE.round()); | 17 double.MAX_FINITE.round()); |
| 20 | 18 |
| 21 Expect.equals(0, (-double.MIN_POSITIVE).round()); | 19 Expect.equals(0, (-double.MIN_POSITIVE).round()); |
| 22 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).round()); | 20 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).round()); |
| 23 Expect.equals(0, (-1.18e-38).round()); | 21 Expect.equals(0, (-1.18e-38).round()); |
| 24 Expect.equals(0, (-1.18e-38 * 2).round()); | 22 Expect.equals(0, (-1.18e-38 * 2).round()); |
| 25 Expect.equals(-1, (-0.5).round()); | 23 Expect.equals(-1, (-0.5).round()); |
| 26 Expect.equals(-1, (-0.9999999999999999).round()); | 24 Expect.equals(-1, (-0.9999999999999999).round()); |
| 27 Expect.equals(-1, (-1.0).round()); | 25 Expect.equals(-1, (-1.0).round()); |
| 28 Expect.equals(-1, (-1.000000000000001).round()); | 26 Expect.equals(-1, (-1.000000000000001).round()); |
| 29 Expect.equals(-9007199254740991, (-9007199254740991.0).round()); | |
| 30 Expect.equals(-9007199254740992, (-9007199254740992.0).round()); | |
| 31 Expect.equals(-179769313486231570814527423731704356798070567525844996598917476
80315726078002853876058955863276687817154045895351438246423432132688946418276846
75467035375169860499105765512820762454900903893289440758685084551339423045832369
03222948165808559332123348274797826204144723168738177180919299881250404026184124
858368, | 27 Expect.equals(-179769313486231570814527423731704356798070567525844996598917476
80315726078002853876058955863276687817154045895351438246423432132688946418276846
75467035375169860499105765512820762454900903893289440758685084551339423045832369
03222948165808559332123348274797826204144723168738177180919299881250404026184124
858368, |
| 32 (-double.MAX_FINITE).round()); | 28 (-double.MAX_FINITE).round()); |
| 33 | 29 |
| 34 Expect.isTrue(0.0.round() is int); | 30 Expect.isTrue(0.0.round() is int); |
| 35 Expect.isTrue(double.MIN_POSITIVE.round() is int); | 31 Expect.isTrue(double.MIN_POSITIVE.round() is int); |
| 36 Expect.isTrue((2.0 * double.MIN_POSITIVE).round() is int); | 32 Expect.isTrue((2.0 * double.MIN_POSITIVE).round() is int); |
| 37 Expect.isTrue((1.18e-38).round() is int); | 33 Expect.isTrue((1.18e-38).round() is int); |
| 38 Expect.isTrue((1.18e-38 * 2).round() is int); | 34 Expect.isTrue((1.18e-38 * 2).round() is int); |
| 39 Expect.isTrue(0.5.round() is int); | 35 Expect.isTrue(0.5.round() is int); |
| 40 Expect.isTrue(0.9999999999999999.round() is int); | 36 Expect.isTrue(0.9999999999999999.round() is int); |
| 41 Expect.isTrue(1.0.round() is int); | 37 Expect.isTrue(1.0.round() is int); |
| 42 Expect.isTrue(1.000000000000001.round() is int); | 38 Expect.isTrue(1.000000000000001.round() is int); |
| 43 Expect.isTrue(9007199254740991.0.round() is int); | |
| 44 Expect.isTrue(9007199254740992.0.round() is int); | |
| 45 Expect.isTrue(double.MAX_FINITE.round() is int); | 39 Expect.isTrue(double.MAX_FINITE.round() is int); |
| 46 | 40 |
| 47 Expect.isTrue((-double.MIN_POSITIVE).round() is int); | 41 Expect.isTrue((-double.MIN_POSITIVE).round() is int); |
| 48 Expect.isTrue((2.0 * -double.MIN_POSITIVE).round() is int); | 42 Expect.isTrue((2.0 * -double.MIN_POSITIVE).round() is int); |
| 49 Expect.isTrue((-1.18e-38).round() is int); | 43 Expect.isTrue((-1.18e-38).round() is int); |
| 50 Expect.isTrue((-1.18e-38 * 2).round() is int); | 44 Expect.isTrue((-1.18e-38 * 2).round() is int); |
| 51 Expect.isTrue((-0.5).round() is int); | 45 Expect.isTrue((-0.5).round() is int); |
| 52 Expect.isTrue((-0.9999999999999999).round() is int); | 46 Expect.isTrue((-0.9999999999999999).round() is int); |
| 53 Expect.isTrue((-1.0).round() is int); | 47 Expect.isTrue((-1.0).round() is int); |
| 54 Expect.isTrue((-1.000000000000001).round() is int); | 48 Expect.isTrue((-1.000000000000001).round() is int); |
| 55 Expect.isTrue((-9007199254740991.0).round() is int); | |
| 56 Expect.isTrue((-9007199254740992.0).round() is int); | |
| 57 Expect.isTrue((-double.MAX_FINITE).round() is int); | 49 Expect.isTrue((-double.MAX_FINITE).round() is int); |
| 58 } | 50 } |
| OLD | NEW |