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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 main() { | 7 main() { |
8 Expect.equals(0, 0.0.ceil()); | 8 Expect.equals(0, 0.0.ceil()); |
9 Expect.equals(1, double.MIN_POSITIVE.ceil()); | 9 Expect.equals(1, double.MIN_POSITIVE.ceil()); |
10 Expect.equals(1, (2.0 * double.MIN_POSITIVE).ceil()); | 10 Expect.equals(1, (2.0 * double.MIN_POSITIVE).ceil()); |
11 Expect.equals(1, (1.18e-38).ceil()); | 11 Expect.equals(1, (1.18e-38).ceil()); |
12 Expect.equals(1, (1.18e-38 * 2).ceil()); | 12 Expect.equals(1, (1.18e-38 * 2).ceil()); |
13 Expect.equals(1, 0.49999999999999994.ceil()); | 13 Expect.equals(1, 0.49999999999999994.ceil()); |
14 Expect.equals(1, 0.5.ceil()); | 14 Expect.equals(1, 0.5.ceil()); |
15 Expect.equals(1, 0.9999999999999999.ceil()); | 15 Expect.equals(1, 0.9999999999999999.ceil()); |
16 Expect.equals(1, 1.0.ceil()); | 16 Expect.equals(1, 1.0.ceil()); |
17 Expect.equals(2, 1.000000000000001.ceil()); | 17 Expect.equals(2, 1.000000000000001.ceil()); |
18 // The following numbers are on the border of 52 bits. | 18 // The following numbers are on the border of 52 bits. |
19 // For example: 4503599627370499 + 0.5 => 4503599627370500. | 19 // For example: 4503599627370499 + 0.5 => 4503599627370500. |
20 Expect.equals(4503599627370496, 4503599627370496.0.ceil()); | 20 Expect.equals(4503599627370496, 4503599627370496.0.ceil()); |
21 Expect.equals(4503599627370497, 4503599627370497.0.ceil()); | 21 Expect.equals(4503599627370497, 4503599627370497.0.ceil()); |
22 Expect.equals(4503599627370498, 4503599627370498.0.ceil()); | 22 Expect.equals(4503599627370498, 4503599627370498.0.ceil()); |
23 Expect.equals(4503599627370499, 4503599627370499.0.ceil()); | 23 Expect.equals(4503599627370499, 4503599627370499.0.ceil()); |
24 | 24 |
25 Expect.equals(9007199254740991, 9007199254740991.0.ceil()); | 25 Expect.equals(9007199254740991, 9007199254740991.0.ceil()); |
26 Expect.equals(9007199254740992, 9007199254740992.0.ceil()); | 26 Expect.equals(9007199254740992, 9007199254740992.0.ceil()); |
27 Expect.equals(1797693134862315708145274237317043567980705675258449965989174768
03157260780028538760589558632766878171540458953514382464234321326889464182768467
54670353751698604991057655128207624549009038932894407586850845513394230458323690
32229481658085593321233482747978262041447231687381771809192998812504040261841248
58368, | 27 Expect.equals( |
28 double.MAX_FINITE.ceil()); | 28 17976931348623157081452742373170435679807056752584499659891747680315726078
00285387605895586327668781715404589535143824642343213268894641827684675467035375
16986049910576551282076245490090389328944075868508455133942304583236903222948165
808559332123348274797826204144723168738177180919299881250404026184124858368, |
| 29 double.MAX_FINITE.ceil()); |
29 | 30 |
30 Expect.equals(0, (-double.MIN_POSITIVE).ceil()); | 31 Expect.equals(0, (-double.MIN_POSITIVE).ceil()); |
31 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).ceil()); | 32 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).ceil()); |
32 Expect.equals(0, (-1.18e-38).ceil()); | 33 Expect.equals(0, (-1.18e-38).ceil()); |
33 Expect.equals(0, (-1.18e-38 * 2).ceil()); | 34 Expect.equals(0, (-1.18e-38 * 2).ceil()); |
34 Expect.equals(0, (-0.49999999999999994).ceil()); | 35 Expect.equals(0, (-0.49999999999999994).ceil()); |
35 Expect.equals(0, (-0.5).ceil()); | 36 Expect.equals(0, (-0.5).ceil()); |
36 Expect.equals(0, (-0.9999999999999999).ceil()); | 37 Expect.equals(0, (-0.9999999999999999).ceil()); |
37 Expect.equals(-1, (-1.0).ceil()); | 38 Expect.equals(-1, (-1.0).ceil()); |
38 Expect.equals(-1, (-1.000000000000001).ceil()); | 39 Expect.equals(-1, (-1.000000000000001).ceil()); |
39 Expect.equals(-4503599627370496, (-4503599627370496.0).ceil()); | 40 Expect.equals(-4503599627370496, (-4503599627370496.0).ceil()); |
40 Expect.equals(-4503599627370497, (-4503599627370497.0).ceil()); | 41 Expect.equals(-4503599627370497, (-4503599627370497.0).ceil()); |
41 Expect.equals(-4503599627370498, (-4503599627370498.0).ceil()); | 42 Expect.equals(-4503599627370498, (-4503599627370498.0).ceil()); |
42 Expect.equals(-4503599627370499, (-4503599627370499.0).ceil()); | 43 Expect.equals(-4503599627370499, (-4503599627370499.0).ceil()); |
43 Expect.equals(-9007199254740991, (-9007199254740991.0).ceil()); | 44 Expect.equals(-9007199254740991, (-9007199254740991.0).ceil()); |
44 Expect.equals(-9007199254740992, (-9007199254740992.0).ceil()); | 45 Expect.equals(-9007199254740992, (-9007199254740992.0).ceil()); |
45 Expect.equals(-179769313486231570814527423731704356798070567525844996598917476
80315726078002853876058955863276687817154045895351438246423432132688946418276846
75467035375169860499105765512820762454900903893289440758685084551339423045832369
03222948165808559332123348274797826204144723168738177180919299881250404026184124
858368, | 46 Expect.equals( |
46 (-double.MAX_FINITE).ceil()); | 47 -1797693134862315708145274237317043567980705675258449965989174768031572607
80028538760589558632766878171540458953514382464234321326889464182768467546703537
51698604991057655128207624549009038932894407586850845513394230458323690322294816
5808559332123348274797826204144723168738177180919299881250404026184124858368, |
| 48 (-double.MAX_FINITE).ceil()); |
47 | 49 |
48 Expect.isTrue(0.0.ceil() is int); | 50 Expect.isTrue(0.0.ceil() is int); |
49 Expect.isTrue(double.MIN_POSITIVE.ceil() is int); | 51 Expect.isTrue(double.MIN_POSITIVE.ceil() is int); |
50 Expect.isTrue((2.0 * double.MIN_POSITIVE).ceil() is int); | 52 Expect.isTrue((2.0 * double.MIN_POSITIVE).ceil() is int); |
51 Expect.isTrue((1.18e-38).ceil() is int); | 53 Expect.isTrue((1.18e-38).ceil() is int); |
52 Expect.isTrue((1.18e-38 * 2).ceil() is int); | 54 Expect.isTrue((1.18e-38 * 2).ceil() is int); |
53 Expect.isTrue(0.49999999999999994.ceil() is int); | 55 Expect.isTrue(0.49999999999999994.ceil() is int); |
54 Expect.isTrue(0.5.ceil() is int); | 56 Expect.isTrue(0.5.ceil() is int); |
55 Expect.isTrue(0.9999999999999999.ceil() is int); | 57 Expect.isTrue(0.9999999999999999.ceil() is int); |
56 Expect.isTrue(1.0.ceil() is int); | 58 Expect.isTrue(1.0.ceil() is int); |
(...skipping 15 matching lines...) Expand all Loading... |
72 Expect.isTrue((-0.9999999999999999).ceil() is int); | 74 Expect.isTrue((-0.9999999999999999).ceil() is int); |
73 Expect.isTrue((-1.0).ceil() is int); | 75 Expect.isTrue((-1.0).ceil() is int); |
74 Expect.isTrue((-1.000000000000001).ceil() is int); | 76 Expect.isTrue((-1.000000000000001).ceil() is int); |
75 Expect.isTrue((-4503599627370496.0).ceil() is int); | 77 Expect.isTrue((-4503599627370496.0).ceil() is int); |
76 Expect.isTrue((-4503599627370497.0).ceil() is int); | 78 Expect.isTrue((-4503599627370497.0).ceil() is int); |
77 Expect.isTrue((-4503599627370498.0).ceil() is int); | 79 Expect.isTrue((-4503599627370498.0).ceil() is int); |
78 Expect.isTrue((-4503599627370499.0).ceil() is int); | 80 Expect.isTrue((-4503599627370499.0).ceil() is int); |
79 Expect.isTrue((-9007199254740991.0).ceil() is int); | 81 Expect.isTrue((-9007199254740991.0).ceil() is int); |
80 Expect.isTrue((-9007199254740992.0).ceil() is int); | 82 Expect.isTrue((-9007199254740992.0).ceil() is int); |
81 Expect.isTrue((-double.MAX_FINITE).ceil() is int); | 83 Expect.isTrue((-double.MAX_FINITE).ceil() is int); |
82 } | 84 } |
OLD | NEW |