'Eh Heph, could you clarify that for me a little bit.
You want to put together a table of what times the planets will be aligned, and simply ignore the apparent movement of the planets through the starfield?
First of all, the vast majority of the calls will be made during worldgen anyway, so I don't see how we gain anything from calculating everything before worldgen and storing a table in memory. Just check the function as often as you would need a table entry, and discard the result when the date has passed. That way, you don't end up spending system resources on the parts of the almanac that never come.
I recognize that stars aren't a problem, as they are effectively fixed, but planets, their movements and their relative position to constellations are pretty important to most forms of astrology, and I don't see how pre-calculating their movements years in advance could possibly be economical.
Here's my counter proposal:
We build an almanac table of the cyclic events at the start of worldgen, and then calculate the non-cyclic stuff closer to the time when we need it.
We build a starfield, that is effectively a fixed formation of major stars and constellations, that scrolls across the sky each night. Only about 3/4 of it will be visible on a given night, and only about 1/2 at a given time. hHis is pretty much the precalculated almanac you suggested, but without alignments.
Because the starfield repeats consistently for the lifetime of the world, it's worthwhile to save it, instead of building it from a function.
It's the planets that make that a pain, so they could be plugged into the starfield at a later time.I suggest building a table of near future events, and adding to it at the start of every year or season. Old sections of the table can be discarded, after they are no longer useful.
In the event that somebody wants to make a prediction more than a few table segments in advance, we'll need to make some extra calculations at that time, but I think that's more reasonable than making all potential calculations and then storing the results, potentially for hundreds of worldgen years.
My reading (which wasn't terribly extensive) indicates that the movement of planets across the starfield takes a day or two to make a visible difference. This means that as far as star gazers are concerned, stars only move if you look at them on successive days. This means that no significant astrological event will take less than 24 hours, so we only have to plot the positions of the stars in the field once a day.
So, once for each day, we calculate the position of each planet, relative to the star field, and record that value. At that time, we also check to see if the planet is in proximity to any major stars or constellations, and record all the important events.
Since constellations are larger they should dominate a larger area. e.g. the planet doesn't need to be as close to have an effect.
This gives us most of the benefits of a precalculated table, but it scales more nicely, which is important when you have no idea how much data you're going to need for a given world.