On 6 March 2014 17:26, Patrick Wallace <[log in to unmask]> wrote: > David, > > >> The longitude at the pole is indeterminate, but whatever >> random numerical value is returned by atan2 is no less useful >> (and no more useful) than a fixed value of zero. > > Tread carefully: atan2(0.0,0.0) is undefined. You don't get a > "random" answer, more likely an exception. > > In my code I test x and y for exactly zero, as opposed to merely > tiny, and only then force longitude to zero. You're quite safe > doing atan2(epsilon,zero) or atan2(zero,epsilon), and if that > generates erratic results it just means the application needs to > be seen to. I've got the "latitude = (exactly) 90" case covered. The problem was that someone was using AST with tiny pixels (0.01 arc-sec) and previously, AST set longitude to zero for any point less than 0.004 arc-sec from the pole, which gave problems at the half pixel level. David > > Patrick Wallace > ----------------------------------------------------------------- > TPOINT SOFTWARE tel/fax +44-1235-531198 > 19 Sutton Wick Lane, Drayton > Abingdon > Oxfordshire OX14 4HH > United Kingdom www.tpsoft.demon.co.uk > _________________________________________________________________ > > Except where indicated, the contents of this email > are for the named recipient(s) only and must not be > made public or otherwise disclosed to third parties. > ----------------------------------------------------------------- > >