07.01.2026, 15:58
Now changed to this and seems to do the trick as it clamps fo between -1 and 1:
local fo = math.max(math.min(math.tan(declination + dfo) * math.tan(latitude * rads), 1), -1)
local fo = math.max(math.min(math.tan(declination + dfo) * math.tan(latitude * rads), 1), -1)