| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'package:expect/expect.dart'; | |
| 6 | |
| 7 main() { | |
| 8 Expect.equals(0, 0.0.round()); | |
| 9 Expect.equals(0, double.MIN_POSITIVE.round()); | |
| 10 Expect.equals(0, (2.0 * double.MIN_POSITIVE).round()); | |
| 11 Expect.equals(0, (1.18e-38).round()); | |
| 12 Expect.equals(0, (1.18e-38 * 2).round()); | |
| 13 Expect.equals(1, 0.5.round()); | |
| 14 Expect.equals(1, 0.9999999999999999.round()); | |
| 15 Expect.equals(1, 1.0.round()); | |
| 16 Expect.equals(1, 1.000000000000001.round()); | |
| 17 | |
| 18 Expect.equals( | |
| 19 17976931348623157081452742373170435679807056752584499659891747680315726078
00285387605895586327668781715404589535143824642343213268894641827684675467035375
16986049910576551282076245490090389328944075868508455133942304583236903222948165
808559332123348274797826204144723168738177180919299881250404026184124858368, | |
| 20 double.MAX_FINITE.round()); | |
| 21 | |
| 22 Expect.equals(0, (-double.MIN_POSITIVE).round()); | |
| 23 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).round()); | |
| 24 Expect.equals(0, (-1.18e-38).round()); | |
| 25 Expect.equals(0, (-1.18e-38 * 2).round()); | |
| 26 Expect.equals(-1, (-0.5).round()); | |
| 27 Expect.equals(-1, (-0.9999999999999999).round()); | |
| 28 Expect.equals(-1, (-1.0).round()); | |
| 29 Expect.equals(-1, (-1.000000000000001).round()); | |
| 30 Expect.equals( | |
| 31 -1797693134862315708145274237317043567980705675258449965989174768031572607
80028538760589558632766878171540458953514382464234321326889464182768467546703537
51698604991057655128207624549009038932894407586850845513394230458323690322294816
5808559332123348274797826204144723168738177180919299881250404026184124858368, | |
| 32 (-double.MAX_FINITE).round()); | |
| 33 | |
| 34 Expect.isTrue(0.0.round() is int); | |
| 35 Expect.isTrue(double.MIN_POSITIVE.round() is int); | |
| 36 Expect.isTrue((2.0 * double.MIN_POSITIVE).round() is int); | |
| 37 Expect.isTrue((1.18e-38).round() is int); | |
| 38 Expect.isTrue((1.18e-38 * 2).round() is int); | |
| 39 Expect.isTrue(0.5.round() is int); | |
| 40 Expect.isTrue(0.9999999999999999.round() is int); | |
| 41 Expect.isTrue(1.0.round() is int); | |
| 42 Expect.isTrue(1.000000000000001.round() is int); | |
| 43 Expect.isTrue(double.MAX_FINITE.round() is int); | |
| 44 | |
| 45 Expect.isTrue((-double.MIN_POSITIVE).round() is int); | |
| 46 Expect.isTrue((2.0 * -double.MIN_POSITIVE).round() is int); | |
| 47 Expect.isTrue((-1.18e-38).round() is int); | |
| 48 Expect.isTrue((-1.18e-38 * 2).round() is int); | |
| 49 Expect.isTrue((-0.5).round() is int); | |
| 50 Expect.isTrue((-0.9999999999999999).round() is int); | |
| 51 Expect.isTrue((-1.0).round() is int); | |
| 52 Expect.isTrue((-1.000000000000001).round() is int); | |
| 53 Expect.isTrue((-double.MAX_FINITE).round() is int); | |
| 54 } | |
| OLD | NEW |