From 7dbfc2590d842a16efcb2f00413b709ed84aed44 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Sun, 14 Mar 2021 07:28:35 -0400 Subject: geodesic.c: fix conditions under which hypot workaround is applied. Now it applies with 32-bit compiles for all versioins of Visual Studio; versions tested on: 2015, 2017, 2019. --- src/geodesic.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/geodesic.c b/src/geodesic.c index d5751227..65ca1458 100644 --- a/src/geodesic.c +++ b/src/geodesic.c @@ -127,9 +127,15 @@ static void swapx(real* x, real* y) { real t = *x; *x = *y; *y = t; } static void norm2(real* sinx, real* cosx) { -#if defined(_MSC_VER) && _MSC_VER <= 1900 - /* Visual Studio 2015 (32-bit) has inaccurate hypot, the same as in some - * versions of python https://bugs.python.org/issue43088 */ +#if defined(_MSC_VER) && defined(_M_IX86) + /* hypot for Visual Studio (A=win32) fails monotonicity, e.g., with + * x = 0.6102683302836215 + * y1 = 0.7906090004346522 + * y2 = y1 + 1e-16 + * the test + * hypot(x, y2) >= hypot(x, y1) + * fails. See also + * https://bugs.python.org/issue43088 */ real r = sqrt(*sinx * *sinx + *cosx * *cosx); #else real r = hypot(*sinx, *cosx); -- cgit v1.2.3