From 9efc76ccbf2488acd09c514c12aeba5641e5aeb1 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Mon, 5 Mar 2012 10:04:10 +0000 Subject: [PATCH] Fix double-rounding in strtod for MinGW. BUG=v8:1062 TEST= Review URL: https://chromiumcodereview.appspot.com/9578011 Patch from Jonathan Liu . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10917 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/strtod.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/strtod.cc b/src/strtod.cc index be79c80..0dc618a 100644 --- a/src/strtod.cc +++ b/src/strtod.cc @@ -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 buffer, static bool DoubleStrtod(Vector 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) { -- 2.7.4