mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
The findSunRiseSet algorithm's Phase 3 converges on the sunrise elevation using a symmetric stepping approach. Due to the convergence step size, the final elevation can land slightly below the -0.8333° threshold (e.g. -0.838° instead of -0.8333°). When this happens, Phase 4's while-loop condition (sunPos.elevation > -threshold) evaluates to false immediately, causing it to skip entirely. Phase 5 then converges to the same point, producing identical sunrise and sunset times. The fix adds a small offset (daynum = sunrise + 0.001, ~1.4 minutes) at the start of Phase 4, ensuring the sun is clearly above the threshold before the sunset search begins. This is a deterministic fix — the bug was reproducible 100% of the time for any location where the convergence lands below threshold (e.g. equator at equinox). Fixes: sunrise/sunset showing identical times (~30% of location/date combinations)