Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: tests/corelib/double_round_test.dart

Issue 12667008: Update status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/corelib/double_round3_test.dart ('k') | tests/corelib/double_round_to_double2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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(0, 0.49999999999999994.round());
12 Expect.equals(1, 0.5.round()); 11 Expect.equals(1, 0.5.round());
13 Expect.equals(1, 0.9999999999999999.round()); 12 Expect.equals(1, 0.9999999999999999.round());
14 Expect.equals(1, 1.0.round()); 13 Expect.equals(1, 1.0.round());
15 Expect.equals(1, 1.000000000000001.round()); 14 Expect.equals(1, 1.000000000000001.round());
16 // The following numbers are on the border of 52 bits. 15 // The following numbers are on the border of 52 bits.
17 // For example: 4503599627370499 + 0.5 => 4503599627370500. 16 // For example: 4503599627370499 + 0.5 => 4503599627370500.
18 Expect.equals(4503599627370496, 4503599627370496.0.round()); 17 Expect.equals(4503599627370496, 4503599627370496.0.round());
19 Expect.equals(4503599627370497, 4503599627370497.0.round()); 18 Expect.equals(4503599627370497, 4503599627370497.0.round());
20 Expect.equals(4503599627370498, 4503599627370498.0.round()); 19 Expect.equals(4503599627370498, 4503599627370498.0.round());
21 Expect.equals(4503599627370499, 4503599627370499.0.round()); 20 Expect.equals(4503599627370499, 4503599627370499.0.round());
22 21
23 Expect.equals(9007199254740991, 9007199254740991.0.round()); 22 Expect.equals(9007199254740991, 9007199254740991.0.round());
24 Expect.equals(9007199254740992, 9007199254740992.0.round()); 23 Expect.equals(9007199254740992, 9007199254740992.0.round());
25 Expect.equals(1797693134862315708145274237317043567980705675258449965989174768 03157260780028538760589558632766878171540458953514382464234321326889464182768467 54670353751698604991057655128207624549009038932894407586850845513394230458323690 32229481658085593321233482747978262041447231687381771809192998812504040261841248 58368, 24 Expect.equals(1797693134862315708145274237317043567980705675258449965989174768 03157260780028538760589558632766878171540458953514382464234321326889464182768467 54670353751698604991057655128207624549009038932894407586850845513394230458323690 32229481658085593321233482747978262041447231687381771809192998812504040261841248 58368,
26 double.MAX_FINITE.round()); 25 double.MAX_FINITE.round());
27 26
28 Expect.equals(0, (-double.MIN_POSITIVE).round()); 27 Expect.equals(0, (-double.MIN_POSITIVE).round());
29 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).round()); 28 Expect.equals(0, (2.0 * -double.MIN_POSITIVE).round());
30 Expect.equals(0, (-1.18e-38).round()); 29 Expect.equals(0, (-1.18e-38).round());
31 Expect.equals(0, (-1.18e-38 * 2).round()); 30 Expect.equals(0, (-1.18e-38 * 2).round());
32 Expect.equals(0, (-0.49999999999999994).round());
33 Expect.equals(-1, (-0.5).round()); 31 Expect.equals(-1, (-0.5).round());
34 Expect.equals(-1, (-0.9999999999999999).round()); 32 Expect.equals(-1, (-0.9999999999999999).round());
35 Expect.equals(-1, (-1.0).round()); 33 Expect.equals(-1, (-1.0).round());
36 Expect.equals(-1, (-1.000000000000001).round()); 34 Expect.equals(-1, (-1.000000000000001).round());
37 Expect.equals(-4503599627370496, (-4503599627370496.0).round()); 35 Expect.equals(-4503599627370496, (-4503599627370496.0).round());
38 Expect.equals(-4503599627370497, (-4503599627370497.0).round()); 36 Expect.equals(-4503599627370497, (-4503599627370497.0).round());
39 Expect.equals(-4503599627370498, (-4503599627370498.0).round()); 37 Expect.equals(-4503599627370498, (-4503599627370498.0).round());
40 Expect.equals(-4503599627370499, (-4503599627370499.0).round()); 38 Expect.equals(-4503599627370499, (-4503599627370499.0).round());
41 Expect.equals(-9007199254740991, (-9007199254740991.0).round()); 39 Expect.equals(-9007199254740991, (-9007199254740991.0).round());
42 Expect.equals(-9007199254740992, (-9007199254740992.0).round()); 40 Expect.equals(-9007199254740992, (-9007199254740992.0).round());
43 Expect.equals(-179769313486231570814527423731704356798070567525844996598917476 80315726078002853876058955863276687817154045895351438246423432132688946418276846 75467035375169860499105765512820762454900903893289440758685084551339423045832369 03222948165808559332123348274797826204144723168738177180919299881250404026184124 858368, 41 Expect.equals(-179769313486231570814527423731704356798070567525844996598917476 80315726078002853876058955863276687817154045895351438246423432132688946418276846 75467035375169860499105765512820762454900903893289440758685084551339423045832369 03222948165808559332123348274797826204144723168738177180919299881250404026184124 858368,
44 (-double.MAX_FINITE).round()); 42 (-double.MAX_FINITE).round());
45 43
46 Expect.isTrue(0.0.round() is int); 44 Expect.isTrue(0.0.round() is int);
47 Expect.isTrue(double.MIN_POSITIVE.round() is int); 45 Expect.isTrue(double.MIN_POSITIVE.round() is int);
48 Expect.isTrue((2.0 * double.MIN_POSITIVE).round() is int); 46 Expect.isTrue((2.0 * double.MIN_POSITIVE).round() is int);
49 Expect.isTrue((1.18e-38).round() is int); 47 Expect.isTrue((1.18e-38).round() is int);
50 Expect.isTrue((1.18e-38 * 2).round() is int); 48 Expect.isTrue((1.18e-38 * 2).round() is int);
51 Expect.isTrue(0.49999999999999994.round() is int);
52 Expect.isTrue(0.5.round() is int); 49 Expect.isTrue(0.5.round() is int);
53 Expect.isTrue(0.9999999999999999.round() is int); 50 Expect.isTrue(0.9999999999999999.round() is int);
54 Expect.isTrue(1.0.round() is int); 51 Expect.isTrue(1.0.round() is int);
55 Expect.isTrue(1.000000000000001.round() is int); 52 Expect.isTrue(1.000000000000001.round() is int);
56 Expect.isTrue(4503599627370496.0.round() is int); 53 Expect.isTrue(4503599627370496.0.round() is int);
57 Expect.isTrue(4503599627370497.0.round() is int); 54 Expect.isTrue(4503599627370497.0.round() is int);
58 Expect.isTrue(4503599627370498.0.round() is int); 55 Expect.isTrue(4503599627370498.0.round() is int);
59 Expect.isTrue(4503599627370499.0.round() is int); 56 Expect.isTrue(4503599627370499.0.round() is int);
60 Expect.isTrue(9007199254740991.0.round() is int); 57 Expect.isTrue(9007199254740991.0.round() is int);
61 Expect.isTrue(9007199254740992.0.round() is int); 58 Expect.isTrue(9007199254740992.0.round() is int);
62 Expect.isTrue(double.MAX_FINITE.round() is int); 59 Expect.isTrue(double.MAX_FINITE.round() is int);
63 60
64 Expect.isTrue((-double.MIN_POSITIVE).round() is int); 61 Expect.isTrue((-double.MIN_POSITIVE).round() is int);
65 Expect.isTrue((2.0 * -double.MIN_POSITIVE).round() is int); 62 Expect.isTrue((2.0 * -double.MIN_POSITIVE).round() is int);
66 Expect.isTrue((-1.18e-38).round() is int); 63 Expect.isTrue((-1.18e-38).round() is int);
67 Expect.isTrue((-1.18e-38 * 2).round() is int); 64 Expect.isTrue((-1.18e-38 * 2).round() is int);
68 Expect.isTrue((-0.49999999999999994).round() is int);
69 Expect.isTrue((-0.5).round() is int); 65 Expect.isTrue((-0.5).round() is int);
70 Expect.isTrue((-0.9999999999999999).round() is int); 66 Expect.isTrue((-0.9999999999999999).round() is int);
71 Expect.isTrue((-1.0).round() is int); 67 Expect.isTrue((-1.0).round() is int);
72 Expect.isTrue((-1.000000000000001).round() is int); 68 Expect.isTrue((-1.000000000000001).round() is int);
73 Expect.isTrue((-4503599627370496.0).round() is int); 69 Expect.isTrue((-4503599627370496.0).round() is int);
74 Expect.isTrue((-4503599627370497.0).round() is int); 70 Expect.isTrue((-4503599627370497.0).round() is int);
75 Expect.isTrue((-4503599627370498.0).round() is int); 71 Expect.isTrue((-4503599627370498.0).round() is int);
76 Expect.isTrue((-4503599627370499.0).round() is int); 72 Expect.isTrue((-4503599627370499.0).round() is int);
77 Expect.isTrue((-9007199254740991.0).round() is int); 73 Expect.isTrue((-9007199254740991.0).round() is int);
78 Expect.isTrue((-9007199254740992.0).round() is int); 74 Expect.isTrue((-9007199254740992.0).round() is int);
79 Expect.isTrue((-double.MAX_FINITE).round() is int); 75 Expect.isTrue((-double.MAX_FINITE).round() is int);
80 } 76 }
OLDNEW
« no previous file with comments | « tests/corelib/double_round3_test.dart ('k') | tests/corelib/double_round_to_double2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698