aboutsummaryrefslogtreecommitdiff
path: root/src/geodesic.c
diff options
context:
space:
mode:
authorCharles Karney <charles@karney.com>2021-03-14 07:28:35 -0400
committerCharles Karney <charles@karney.com>2021-03-14 07:28:35 -0400
commit7dbfc2590d842a16efcb2f00413b709ed84aed44 (patch)
tree1dcd947b274dc298ef3ea67230286810eec3e75a /src/geodesic.c
parent468b43c28911d349a0b0497dc663a520525c9589 (diff)
downloadPROJ-7dbfc2590d842a16efcb2f00413b709ed84aed44.tar.gz
PROJ-7dbfc2590d842a16efcb2f00413b709ed84aed44.zip
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.
Diffstat (limited to 'src/geodesic.c')
-rw-r--r--src/geodesic.c12
1 files changed, 9 insertions, 3 deletions
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);