Merge branch 'master' of https://code.google.com/p/double-conversion
diff --git a/test/cctest/test-bignum-dtoa.cc b/test/cctest/test-bignum-dtoa.cc
index be8fb25..4f618ac 100644
--- a/test/cctest/test-bignum-dtoa.cc
+++ b/test/cctest/test-bignum-dtoa.cc
@@ -282,7 +282,7 @@
CHECK_EQ("332307", buffer.start());
CHECK_EQ(36, point);
- BignumDtoa(1.23405349260765015351e-41f, BIGNUM_DTOA_SHORTEST_SINGLE, 0,
+ BignumDtoa(1.2341e-41f, BIGNUM_DTOA_SHORTEST_SINGLE, 0,
buffer, &length, &point);
CHECK_EQ("12341", buffer.start());
CHECK_EQ(-40, point);
diff --git a/test/cctest/test-fast-dtoa.cc b/test/cctest/test-fast-dtoa.cc
index 3b363ec..0b6915e 100644
--- a/test/cctest/test-fast-dtoa.cc
+++ b/test/cctest/test-fast-dtoa.cc
@@ -32,7 +32,7 @@
Vector<char> buffer(buffer_container, kBufferSize);
int length;
int point;
- int status;
+ bool status;
double min_double = 5e-324;
status = FastDtoa(min_double, FAST_DTOA_SHORTEST, 0,
@@ -102,7 +102,7 @@
Vector<char> buffer(buffer_container, kBufferSize);
int length;
int point;
- int status;
+ bool status;
float min_float = 1e-45f;
status = FastDtoa(min_float, FAST_DTOA_SHORTEST_SINGLE, 0,
@@ -131,7 +131,7 @@
CHECK_EQ("332307", buffer.start());
CHECK_EQ(36, point);
- status = FastDtoa(1.23405349260765015351e-41f, FAST_DTOA_SHORTEST_SINGLE, 0,
+ status = FastDtoa(1.2341e-41f, FAST_DTOA_SHORTEST_SINGLE, 0,
buffer, &length, &point);
CHECK(status);
CHECK_EQ("12341", buffer.start());
@@ -178,7 +178,7 @@
Vector<char> buffer(buffer_container, kBufferSize);
int length;
int point;
- int status;
+ bool status;
status = FastDtoa(1.0, FAST_DTOA_PRECISION, 3, buffer, &length, &point);
CHECK(status);
diff --git a/test/cctest/test-strtod.cc b/test/cctest/test-strtod.cc
index bd50cc4..c5950eb 100644
--- a/test/cctest/test-strtod.cc
+++ b/test/cctest/test-strtod.cc
@@ -515,8 +515,8 @@
CHECK_EQ(3401e34f, StrtofChar("00000340100000", 29));
CHECK_EQ(Single::Infinity(), StrtofChar("00000341000000", 30));
CHECK_EQ(34e37f, StrtofChar("000003400000", 32));
- CHECK_EQ(3.4028235676e+38f, StrtofChar("34028235676", 28));
- CHECK_EQ(3.4028235677e+38f, StrtofChar("34028235677", 28));
+ CHECK_EQ(3.4028234e+38f, StrtofChar("34028235676", 28));
+ CHECK_EQ(3.4028234e+38f, StrtofChar("34028235677", 28));
CHECK_EQ(Single::Infinity(), StrtofChar("34028235678", 28));
// The following number is the result of 89255.0/1e-22. Both floating-point
@@ -538,7 +538,12 @@
// Verify that we don't double round.
// Get the boundary of the boundary.
CHECK_EQ(2.1665680640000002384185791015625e9, 2166568064.0);
+ // Visual Studio gets this wrong and believes that these two numbers are the
+ // same doubles. We want to test our conversion and not the compiler. We
+ // therefore disable the check.
+#ifndef _MSC_VER
CHECK(2.16656806400000023841857910156251e9 != 2166568064.0);
+#endif
CHECK_EQ(2166568192.0f, StrtofChar("21665680640000002384185791015625", -22));
// 0x4fffffff = 8589934080
@@ -551,8 +556,13 @@
CHECK_EQ(8589934592.0f, StrtofChar("858993433600001", -5));
// Verify that we don't double round.
// Get the boundary of the boundary.
+ // Visual Studio gets this wrong. To avoid failing tests because of a broken
+ // compiler we disable the following two tests. They were only testing the
+ // compiler. The real test is still active.
+#ifndef _MSC_VER
CHECK_EQ(8.589934335999999523162841796875e+09, 8589934336.0);
CHECK(8.5899343359999995231628417968749e+09 != 8589934336.0);
+#endif
CHECK_EQ(8589934080.0f, StrtofChar("8589934335999999523162841796875", -21));
// 0x4f000000 = 2147483648
@@ -649,7 +659,7 @@
for (int i = 0; i < kShortStrtodRandomCount; ++i) {
int pos = 0;
for (int j = 0; j < length; ++j) {
- buffer[pos++] = random() % 10 + '0';
+ buffer[pos++] = DeterministicRandom() % 10 + '0';
}
int exponent = DeterministicRandom() % (25*2 + 1) - 25 - length;
buffer[pos] = '\0';
@@ -662,7 +672,7 @@
for (int i = 0; i < kLargeStrtodRandomCount; ++i) {
int pos = 0;
for (int j = 0; j < length; ++j) {
- buffer[pos++] = random() % 10 + '0';
+ buffer[pos++] = DeterministicRandom() % 10 + '0';
}
int exponent = DeterministicRandom() % (308*2 + 1) - 308 - length;
buffer[pos] = '\0';
@@ -716,7 +726,7 @@
for (int i = 0; i < kShortStrtofRandomCount; ++i) {
int pos = 0;
for (int j = 0; j < length; ++j) {
- buffer[pos++] = random() % 10 + '0';
+ buffer[pos++] = DeterministicRandom() % 10 + '0';
}
int exponent = DeterministicRandom() % (5*2 + 1) - 5 - length;
buffer[pos] = '\0';
@@ -729,7 +739,7 @@
for (int i = 0; i < kLargeStrtofRandomCount; ++i) {
int pos = 0;
for (int j = 0; j < length; ++j) {
- buffer[pos++] = random() % 10 + '0';
+ buffer[pos++] = DeterministicRandom() % 10 + '0';
}
int exponent = DeterministicRandom() % (38*2 + 1) - 38 - length;
buffer[pos] = '\0';