X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Firrat.lisp;h=5477d6d666eec37347512c2040cfff1ea5a8ca6e;hb=00a72df911b4089d1bce75684d2ee8da9937447d;hp=0f2b7a321a424d09d40a6c5efdbbe79e48209423;hpb=6349f899f37ca9807461e67cb5e2f8b8bd3beba6;p=sbcl.git diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index 0f2b7a3..5477d6d 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -76,10 +76,30 @@ #!-x86 (def-math-rtn "atan2" 2) (def-math-rtn "sinh" 1) (def-math-rtn "cosh" 1) -#!-win32(def-math-rtn "tanh" 1) -#!-win32(def-math-rtn "asinh" 1) -#!-win32(def-math-rtn "acosh" 1) -#!-win32(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)