From 6f522e6cea478e313535db38c6b31c70dc24561e Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 30 Oct 2008 14:47:42 +0000 Subject: [PATCH] 1.0.21.38: lisp-side %ASIN, %ACOS, %SINH, %TANH, and %HYPOT * For Win32 build robustness: on some toolchains asin &co were not getting linked to the runtime as we'd like to. Caveat: %HYPOT is stupid about under/overflows unlike hypot(). --- src/code/irrat.lisp | 30 +++++++++++++++++++++++++----- src/runtime/win32-os.c | 5 ----- version.lisp-expr | 2 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index c4e9ad463..12751a30a 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -70,20 +70,32 @@ #!-x86 (def-math-rtn "sin" 1) #!-x86 (def-math-rtn "cos" 1) #!-x86 (def-math-rtn "tan" 1) -(def-math-rtn "asin" 1) -(def-math-rtn "acos" 1) #!-x86 (def-math-rtn "atan" 1) #!-x86 (def-math-rtn "atan2" 2) -(def-math-rtn "sinh" 1) -(def-math-rtn "cosh" 1) #!-win32 (progn + (def-math-rtn "acos" 1) + (def-math-rtn "asin" 1) + (def-math-rtn "cosh" 1) + (def-math-rtn "sinh" 1) (def-math-rtn "tanh" 1) (def-math-rtn "asinh" 1) (def-math-rtn "acosh" 1) (def-math-rtn "atanh" 1)) #!+win32 (progn + (declaim (inline %asin)) + (defun %asin (number) + (%atan (/ number (sqrt (- 1 (* number number)))))) + (declaim (inline %acos)) + (defun %acos (number) + (- (/ pi 2) (%asin number))) + (declaim (inline %cosh)) + (defun %cosh (number) + (/ (+ (exp number) (exp (- number))) 2)) + (declaim (inline %sinh)) + (defun %sinh (number) + (/ (- (exp number) (exp (- number))) 2)) (declaim (inline %tanh)) (defun %tanh (number) (/ (%sinh number) (%cosh number))) @@ -107,8 +119,16 @@ #!-x86 (def-math-rtn "log10" 1) #!-win32(def-math-rtn "pow" 2) #!-(or x86 x86-64) (def-math-rtn "sqrt" 1) -(def-math-rtn "hypot" 2) +#!-win32 (def-math-rtn "hypot" 2) #!-(or hpux x86) (def-math-rtn "log1p" 1) + +#!+win32 +(progn + ;; FIXME: libc hypot "computes the sqrt(x*x+y*y) without undue overflow or underflow" + ;; ...we just do the stupid simple thing. + (declaim (inline %hypot)) + (defun %hypot (x y) + (sqrt (+ (* x x) (* y y))))) ;;;; power functions diff --git a/src/runtime/win32-os.c b/src/runtime/win32-os.c index b0e9b6faa..32ff6d054 100644 --- a/src/runtime/win32-os.c +++ b/src/runtime/win32-os.c @@ -540,14 +540,9 @@ void scratch(void) _get_osfhandle(0); _pipe(0,0,0); access(0,0); - acos(0); - asin(0); close(0); - cosh(0); dup(0); - hypot(0, 0); isatty(0); - sinh(0); strerror(42); write(0, 0, 0); RtlUnwind(0, 0, 0, 0); diff --git a/version.lisp-expr b/version.lisp-expr index 4dccc12b4..e9ff68e07 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.21.37" +"1.0.21.38" -- 2.11.4.GIT