PerezHz / PlanetaryEphemeris.jl

Solar System ephemeris Taylor integrator based on JPL DE430/431 dynamical model
Other
19 stars 6 forks source link

Results from `scripts/integrate_ephemeris.jl` change from Julia v1.6 to Julia v1.8 #10

Open LuEdRaMo opened 1 year ago

LuEdRaMo commented 1 year ago

The results from scripts/integrate_ephemeris.jl change from Julia v1.6 to Julia v1.8 due to differences in rounding. For instance, consider the Moon's radius R_moon = 1.1617812418502559e-5. We need R_moon ^ 5 to compute the Moon's inertia tensor, however:

PE_v16_vsv18

lbenet commented 1 year ago

Thanks for reporting this subtlety. I guess this is related to some internals of Julia, which involve the power function, and that may have changed in Julia 1.8.

Are you using here the current master of NEOs.jl?

Aside from that, I'd like to note that (in Juliav1.8):

julia> big(R_moon)^5
2.116517191184560855255820794719949721474183242017690151038850992707508088212283e-25

julia> R_moon*R_moon*R_moon*R_moon*R_moon
2.1165171911845607e-25

It seems then that the nearest Float64 is the one produced in Julia v1.6 (and v1.7)...

PerezHz commented 1 year ago

Thanks for spotting this! In a 10-year integration, the (absolute) difference between PlanetaryEphemeris.jl and DE430 is already around the 0.1 arcsec (i.e., about 1e-6 rad) level for the lunar mantle angles, so I agree that this more reflective of a difference between julia 1.6 and 1.8, while not having much impact in the ephemeris. In extended-body acceleration terms, maybe it would be better to do e.g. (R_M/r)^5 rather than (R_M^5)/(r^5) as it is done now, but I doubt this would make a huge difference wrt how things are now... still, it's good to keep track of this numerical subtleties!