; fortran-atan computes atan of one or two arguments returning a range of values ; compatible with standard fortran (particularly, IBM and MULTICS). ; These are -%pi/2 to %pi/2 for single arg atan, and -%pi to %pi for 2 arg ; atan. LISP unfortunately returns values in the range 0 to 2%pi, and only ; takes two arguments. (declare (fixnum n) (flonum (fortran-atan))) (defun fortran-atan n (prog (x y fa) (declare (flonum x y fa)) (setq x (arg 1) y (cond ((= n 2)(arg 2))(t 1.0)) fa (atan x y)) (return (cond ((= n 1) (cond ((> fa 3.14159265) (-$ fa (*$ 2.0 3.14159265))) (t fa))) (t (cond ((> fa 3.14159265) (-$ fa (*$ 2.0 3.14159265))) (t fa)))))))