Principal phases and lunar age #7

Closed
opened 2026-10-22 22:33:49 -05:00 by jeff · 0 comments
Owner

Part of #1

Parent

#1

What to build

Principal phases and lunar age, from ch. 49. Given an instant and a kind (new Moon, first quarter, full Moon, last quarter): the instant of the next one after it and of the previous one before it, and an iterator over every principal phase between two instants, in order. Results are instants in TT. Meeus's lunation number k stays internal.

Lunar age at an instant is the time since the previous new Moon as found by that search, in days.

Ch. 49 has series of its own and does not need the Moon's or the Sun's position.

The float-to-integer step that finds k must check its input first: @intFromFloat panics on NaN and on values out of range. A NaN or infinite instant gives NaN, never a panic.

Acceptance criteria

  • Ch. 49's worked examples pass to the printed precision
  • The instants agree with a published table of phases (cited) across 1900–2100 within a stated number of minutes
  • Properties: the next phase is after the instant and the previous one is before it; consecutive phases go new → first quarter → full → last quarter; lunar age is never negative and is under about 29.9 days
  • Fuzzing: no panic for any f64 Julian Day, including NaN, ±∞ and extreme finite values
  • Every new public declaration has a doc comment giving units, time scale and reference frame, and citing the chapter and equation of Meeus it implements
  • Every source used is in the README's references cited
  • zig build test, zig build check, zig fmt --exclude zig-pkg --check . and reuse lint pass
Part of #1 ## Parent #1 ## What to build **Principal phases** and **lunar age**, from ch. 49. Given an **instant** and a kind (new Moon, first quarter, full Moon, last quarter): the instant of the next one after it and of the previous one before it, and an iterator over every principal phase between two instants, in order. Results are instants in TT. Meeus's lunation number *k* stays internal. Lunar age at an instant is the time since the previous new Moon as found by that search, in days. Ch. 49 has series of its own and does not need the Moon's or the Sun's position. The float-to-integer step that finds *k* must check its input first: `@intFromFloat` panics on NaN and on values out of range. A NaN or infinite instant gives NaN, never a panic. ## Acceptance criteria - [ ] Ch. 49's worked examples pass to the printed precision - [ ] The instants agree with a published table of phases (cited) across 1900–2100 within a stated number of minutes - [ ] Properties: the next phase is after the instant and the previous one is before it; consecutive phases go new → first quarter → full → last quarter; lunar age is never negative and is under about 29.9 days - [ ] Fuzzing: no panic for any `f64` Julian Day, including NaN, ±∞ and extreme finite values - [ ] Every new public declaration has a doc comment giving units, time scale and reference frame, and citing the chapter and equation of Meeus it implements - [ ] Every source used is in the README's references cited - [ ] `zig build test`, `zig build check`, `zig fmt --exclude zig-pkg --check .` and `reuse lint` pass
jeff self-assigned this 2026-10-22 23:55:39 -05:00
jeff closed this issue 2026-10-23 00:24:55 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Depends on
Reference
jeff/zig-astro#7
No description provided.