From 9c5f98981ae87d5e640bee0e15f7e0e97b46681a Mon Sep 17 00:00:00 2001 From: Don Cross Date: Mon, 27 May 2024 18:01:44 -0400 Subject: [PATCH] Some versions of Python do not allow hypot to have more than 2 arguments. --- demo/python/astronomy.py | 2 +- generate/template/astronomy.py | 2 +- source/python/astronomy/astronomy.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/python/astronomy.py b/demo/python/astronomy.py index e4b922eb..afaca19a 100644 --- a/demo/python/astronomy.py +++ b/demo/python/astronomy.py @@ -1435,7 +1435,7 @@ def _inverse_terra(ovec: List[float], st: float) -> Observer: # Start with initial latitude estimate, based on a spherical Earth. lat = math.atan2(z, p) count = 0 - distanceAu = max(1.0, math.hypot(ovec[0], ovec[1], ovec[2])) + distanceAu = max(1.0, math.sqrt(ovec[0]**2 + ovec[1]**2 + ovec[2]**2)) while True: count += 1 if count > 10: diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index 12040796..5d995118 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -1435,7 +1435,7 @@ def _inverse_terra(ovec: List[float], st: float) -> Observer: # Start with initial latitude estimate, based on a spherical Earth. lat = math.atan2(z, p) count = 0 - distanceAu = max(1.0, math.hypot(ovec[0], ovec[1], ovec[2])) + distanceAu = max(1.0, math.sqrt(ovec[0]**2 + ovec[1]**2 + ovec[2]**2)) while True: count += 1 if count > 10: diff --git a/source/python/astronomy/astronomy.py b/source/python/astronomy/astronomy.py index e4b922eb..afaca19a 100644 --- a/source/python/astronomy/astronomy.py +++ b/source/python/astronomy/astronomy.py @@ -1435,7 +1435,7 @@ def _inverse_terra(ovec: List[float], st: float) -> Observer: # Start with initial latitude estimate, based on a spherical Earth. lat = math.atan2(z, p) count = 0 - distanceAu = max(1.0, math.hypot(ovec[0], ovec[1], ovec[2])) + distanceAu = max(1.0, math.sqrt(ovec[0]**2 + ovec[1]**2 + ovec[2]**2)) while True: count += 1 if count > 10: