liberfa/erfa — pull request #7 by taldcroft (2013-08-09 00:25:03+00:00)
Title: Update precision safeguards to compare absolute values of jd1, jd2

Throughout ERFA there are tests to see which of the two float64 JD values is larger. This is done in order to choose how to update values in order to maintain precision. The current tests just compare the raw values, so that if one of the values is a large negative value it is still considered "smaller". This leads to loss of floating point precision as there is no longer a clean separation of the bit patterns between the "large" and "small" values.

This is especially problematic for use in astropy.time since that code carefully maintains JD1 as a multiple of 0.5 and JD2 as a fractional value between -1 and 1. For dates in the past with JD < 0 this leads to failure in maintaining the required sub-nanosecond precision.

This PR simply changes tests like `if (jd1 > jd2)` to `if (fabs(jd1) > fabs(jd2))`. After making this change in all relevant locations the self tests still pass (`make test`).