mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-24 08:45:55 -04:00
Fixed #347 - Relaxed convergence criteria for inverse_terra functions.
Asking the latitude and longitude directly beneath the Sun causes inverse_terra not to converge, because the convergence increment `W` never got below 1.48e-8, but the convergence limit was 1.0e-8. I increased the limit to 2.0e-8 in all programming language versions. I'm hoping that is a big enough tolerance for all cases now, but I will do more testing to see if further fixes are required for even more distant bodies than the Sun.
This commit is contained in:
@@ -1449,7 +1449,7 @@ def _inverse_terra(ovec: List[float], st: float) -> Observer:
|
||||
radicand = cos2 + _EARTH_FLATTENING_SQUARED*sin2
|
||||
denom = math.sqrt(radicand)
|
||||
W = (factor*sin*cos)/denom - z*cos + p*sin
|
||||
if abs(W) < 1.0e-8:
|
||||
if abs(W) < 2.0e-8:
|
||||
# The error is now negligible
|
||||
break
|
||||
# Error is still too large. Find the next estimate.
|
||||
|
||||
Reference in New Issue
Block a user