Caltech-IPAC / kete

Kete Solar System Survey tools
https://Caltech-IPAC.github.io/kete
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Division for negative number was rounding up #71

Closed dahlend closed 4 months ago

dahlend commented 4 months ago

This is normal behavior for negative numbers on CPUs, but unexpected behavior for math. This required changing the divisions to div_euclid to match the expected behavior.

     let x = -5 / 3;
     assert!(x, -1);

     let y = -5.div_euclid(3); // this is the mathematically expected behavior
     assert!(y, -2);

Fixes #70

Here is sweeping JD back to -1e6 JD, and performing a YMD conversion for each day:

image image image

This is now expected behavior.