From 3090186373cfd7cb4d4b60520a185edf8e138b4f Mon Sep 17 00:00:00 2001 From: Eric Waller Date: Mon, 12 Oct 2026 10:17:03 -0500 Subject: [PATCH] Loosen ITRF velocity test tolerance for last-ulp libm differences (#582) test_velocity_in_ITRF_to_GCRS2 divides by a ~7.3e-5 finite-difference motion, so 1-ulp differences in platform sin/cos/atan shift the relative error by ~1.5e-12. On arm64 macOS it measured 1.801e-11 vs the 1.8e-11 limit (x86_64 glibc: 1.735e-11, same NumPy 2.0.2). --- skyfield/tests/test_positions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/skyfield/tests/test_positions.py b/skyfield/tests/test_positions.py index 8e0f2587..45b80bb8 100644 --- a/skyfield/tests/test_positions.py +++ b/skyfield/tests/test_positions.py @@ -207,7 +207,12 @@ def test_velocity_in_ITRF_to_GCRS2(): relative_error = (length_of(actual_motion - predicted_motion) / length_of(actual_motion)) - acceptable_error = 1.8e-11 + # The motion over 1 second is only ~7.3e-5 of the unit vector, so + # a single-ulp (~1.1e-16) difference in sin/cos/atan from the + # platform's math library moves this ratio by ~1.5e-12. Measured: + # 1.735e-11 on x86_64 (glibc), 1.801e-11 on arm64 (macOS libm), + # same NumPy. Leave room for that last-ulp noise. See #582. + acceptable_error = 2.0e-11 assert relative_error < acceptable_error def test_light_time_method():