wlandsman / IDLAstro

Astronomy related procedures in the commercial IDL language
https://asd.gsfc.nasa.gov/archive/idlastro/
BSD 2-Clause "Simplified" License
144 stars 64 forks source link

WCSSPH2XY #37

Open PaddyLeahy opened 1 year ago

PaddyLeahy commented 1 year ago

In the 'MOL' (Mollweide) case, the Newton iteration can get stuck in a loop before tolerance is reached because the numerator in the iteration step reaches the double precision "EPS" value (defined as the smallest value for which 1-eps NE 1). Fix is to separately test for this:

machine_constants = MACHAR(/DOUBLE) eps = machine_constants.eps > machine_constants.epsneg repeat begin ... endrep until (old condition OR MAX(ABS(numerator) LE eps)