X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Firrat.lisp;h=65c96f152a6ebb8277b7ac799f0747791eb0e60d;hb=672b2f6cb751566526c7f3bb3de6b7d8424760e2;hp=07faa5cd171dad3ebc3339a7592c8f1d30866175;hpb=de01f09401517c1a96de3faeac585e46895940ec;p=sbcl.git diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index 07faa5c..65c96f1 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -46,8 +46,11 @@ `(defun ,name ,ll (,name ,@ll)))) (def %atan2 (x y)) (def %atan (x)) + (def %tan (x)) (def %tan-quick (x)) + (def %cos (x)) (def %cos-quick (x)) + (def %sin (x)) (def %sin-quick (x)) (def %sqrt (x)) (def %log (x)) @@ -73,16 +76,36 @@ #!-x86 (def-math-rtn "atan2" 2) (def-math-rtn "sinh" 1) (def-math-rtn "cosh" 1) -(def-math-rtn "tanh" 1) -(def-math-rtn "asinh" 1) -(def-math-rtn "acosh" 1) -(def-math-rtn "atanh" 1) +#!-win32 +(progn + (def-math-rtn "tanh" 1) + (def-math-rtn "asinh" 1) + (def-math-rtn "acosh" 1) + (def-math-rtn "atanh" 1)) +#!+win32 +(progn + (declaim (inline %tanh)) + (defun %tanh (number) + (/ (%sinh number) (%cosh number))) + (declaim (inline %asinh)) + (defun %asinh (number) + (log (+ number (sqrt (+ (* number number) 1.0d0))) #.(exp 1.0d0))) + (declaim (inline %acosh)) + (defun %acosh (number) + (log (+ number (sqrt (- (* number number) 1.0d0))) #.(exp 1.0d0))) + (declaim (inline %atanh)) + (defun %atanh (number) + (let ((ratio (/ (+ 1 number) (- 1 number)))) + ;; Were we effectively zero? + (if (= ratio -1.0d0) + 0.0d0 + (/ (log ratio #.(exp 1.0d0)) 2.0d0))))) ;;; exponential and logarithmic #!-x86 (def-math-rtn "exp" 1) #!-x86 (def-math-rtn "log" 1) #!-x86 (def-math-rtn "log10" 1) -(def-math-rtn "pow" 2) +#!-win32(def-math-rtn "pow" 2) #!-(or x86 x86-64) (def-math-rtn "sqrt" 1) (def-math-rtn "hypot" 2) #!-(or hpux x86) (def-math-rtn "log1p" 1) @@ -188,6 +211,7 @@ (when (zerop (logior y-ihi y-lo)) (return-from real-expt (coerce 1d0 rtype))) ;; +-NaN return x+y + ;; FIXME: Hardcoded qNaN/sNaN values are not portable. (when (or (> x-ihi #x7ff00000) (and (= x-ihi #x7ff00000) (/= x-lo 0)) (> y-ihi #x7ff00000)