# Diff of /src/code/irrat.lisp

revision 1.1 by wlott, Fri Jul 20 23:52:13 1990 UTC revision 1.2 by wlott, Sat Jul 21 15:33:08 1990 UTC
# Line 21  Line 21
21  ;;;; Random constants, utility functions, and macros.  ;;;; Random constants, utility functions, and macros.
22
23  (defconstant pi 3.14159265358979323846264338327950288419716939937511L0)  (defconstant pi 3.14159265358979323846264338327950288419716939937511L0)
24  (defconstant e 2.71828182845904523536028747135266249775724709369996L0)  ;(defconstant e 2.71828182845904523536028747135266249775724709369996L0)
25
26  (defmacro def-math-rtn (name num-args)  (defmacro def-math-rtn (name num-args)
27    (let ((function (intern (concatenate 'simple-string    (let ((function (intern (concatenate 'simple-string
# Line 187  Line 187
187
188  ;;;; Trigonometic and Related Functions  ;;;; Trigonometic and Related Functions
189
190  ;;; ABS is in numbers.lisp  (defun abs (number)
191      "Returns the absolute value of the number."
192      (number-dispatch ((number number))
193        (((foreach single-float double-float fixnum rational))
194         (abs number))
195        ((complex)
196         (let ((rx (realpart number))
197               (ix (imagpart number)))
198           (etypecase rx
199             (rational
200              (sqrt (+ (* rx rx) (* ix ix))))
201             (single-float
202              (coerce (%hypot (coerce rx 'double-float)
203                              (coerce ix 'double-float))
204                      'single-float))
205             (double-float
206              (%hypot rx ix)))))))
207
208  (defun phase (number)  (defun phase (number)
209    "Returns the angle part of the polar representation of a complex number.    "Returns the angle part of the polar representation of a complex number.
# Line 236  Line 252
252         (if (zerop denom) (error "~S undefined tangent." number)         (if (zerop denom) (error "~S undefined tangent." number)
253             (/ num denom))))))             (/ num denom))))))
254
255  ;;; CIS is in numbers.lisp  (defun cis (theta)
256      "Return cos(Theta) + i sin(Theta), aka exp(i Theta)."
257      (if (complexp theta)
258          (error "Argument to CIS is complex: ~S" theta)
259          (complex (cos theta) (sin theta))))
260
261  #+nil  #+nil
262  (defun in-asin-domain (z)  (defun in-asin-domain (z)

Legend:
 Removed from v.1.1 changed lines Added in v.1.2