[V8] Fix double-rounding in strtod for MinGW
authorJonathan Liu <net147@gmail.com>
Thu, 8 Mar 2012 09:24:12 +0000 (20:24 +1100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Mar 2012 09:41:19 +0000 (10:41 +0100)
Upstream patch: https://chromiumcodereview.appspot.com/9578011/

Change-Id: I6dceb7052f0812a619f660af22ed44b5de88acef
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
src/3rdparty/v8/src/strtod.cc

index be79c80..0dc618a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -175,13 +175,15 @@ static void ReadDiyFp(Vector<const char> buffer,
 static bool DoubleStrtod(Vector<const char> trimmed,
                          int exponent,
                          double* result) {
-#if (defined(V8_TARGET_ARCH_IA32) || defined(USE_SIMULATOR)) && !defined(WIN32)
+#if (defined(V8_TARGET_ARCH_IA32) || defined(USE_SIMULATOR)) \
+    && !defined(_MSC_VER)
   // On x86 the floating-point stack can be 64 or 80 bits wide. If it is
   // 80 bits wide (as is the case on Linux) then double-rounding occurs and the
   // result is not accurate.
-  // We know that Windows32 uses 64 bits and is therefore accurate.
-  // Note that the ARM simulator is compiled for 32bits. It therefore exhibits
-  // the same problem.
+  // We know that Windows32 with MSVC, unlike with MinGW32, uses 64 bits and is
+  // therefore accurate.
+  // Note that the ARM and MIPS simulators are compiled for 32bits. They
+  // therefore exhibit the same problem.
   return false;
 #endif
   if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {