Reviewers: William Hesse,
Description:
Work around windows compiler bug.
Doubles that lie exactly between two doubles should round to the even one.
Please review this at http://codereview.chromium.org/4653003/show
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M test/cctest/test-strtod.cc
Index: test/cctest/test-strtod.cc
diff --git a/test/cctest/test-strtod.cc b/test/cctest/test-strtod.cc
index
34c474ff16e51e2a4076fe15a1334df095e3a8b9..d71d126b48d064f76865526a2557147f0302958e
100644
--- a/test/cctest/test-strtod.cc
+++ b/test/cctest/test-strtod.cc
@@ -259,10 +259,11 @@ TEST(Strtod) {
CHECK_EQ(1234567890123456789052345e115,
StrtodChar("1234567890123456789052345", 115));
- // Boundary cases.
+ // Boundary cases. Boundaries themselves should round to even.
+ //
// 0x1FFFFFFFFFFFF * 2^3 = 72057594037927928
// next: 72057594037927936
- // boundary: 72057594037927932
+ // boundary: 72057594037927932 should round up.
CHECK_EQ(72057594037927928.0, StrtodChar("72057594037927928", 0));
CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927936", 0));
CHECK_EQ(72057594037927936.0, StrtodChar("72057594037927932", 0));
@@ -271,21 +272,21 @@ TEST(Strtod) {
// 0x1FFFFFFFFFFFF * 2^10 = 9223372036854774784
// next: 9223372036854775808
- // boundary: 9223372036854775296
+ // boundary: 9223372036854775296 should round up.
CHECK_EQ(9223372036854774784.0, StrtodChar("9223372036854774784", 0));
CHECK_EQ(9223372036854775808.0, StrtodChar("9223372036854775808", 0));
- CHECK_EQ(9223372036854775296.0, StrtodChar("9223372036854775296", 0));
+ CHECK_EQ(9223372036854775808.0, StrtodChar("9223372036854775296", 0));
CHECK_EQ(9223372036854774784.0, StrtodChar("922337203685477529599999",
-5));
CHECK_EQ(9223372036854775808.0, StrtodChar("922337203685477529600001",
-5));
// 0x1FFFFFFFFFFFF * 2^50 = 10141204801825834086073718800384
// next: 10141204801825835211973625643008
- // boundary: 10141204801825834649023672221696
+ // boundary: 10141204801825834649023672221696 should
round up.
CHECK_EQ(10141204801825834086073718800384.0,
StrtodChar("10141204801825834086073718800384", 0));
CHECK_EQ(10141204801825835211973625643008.0,
StrtodChar("10141204801825835211973625643008", 0));
- CHECK_EQ(10141204801825834649023672221696.0,
+ CHECK_EQ(10141204801825835211973625643008.0,
StrtodChar("10141204801825834649023672221696", 0));
CHECK_EQ(10141204801825834086073718800384.0,
StrtodChar("1014120480182583464902367222169599999", -5));
@@ -295,11 +296,12 @@ TEST(Strtod) {
// 0x1FFFFFFFFFFFF * 2^99 =
5708990770823838890407843763683279797179383808
// next:
5708990770823839524233143877797980545530986496
// boundary:
5708990770823839207320493820740630171355185152
+ // The boundary should round up.
CHECK_EQ(5708990770823838890407843763683279797179383808.0,
StrtodChar("5708990770823838890407843763683279797179383808",
0));
CHECK_EQ(5708990770823839524233143877797980545530986496.0,
StrtodChar("5708990770823839524233143877797980545530986496",
0));
- CHECK_EQ(5708990770823839207320493820740630171355185152.0,
+ CHECK_EQ(5708990770823839524233143877797980545530986496.0,
StrtodChar("5708990770823839207320493820740630171355185152",
0));
CHECK_EQ(5708990770823838890407843763683279797179383808.0,
StrtodChar("5708990770823839207320493820740630171355185151999",
-3));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev