diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp index 2591907ae9b839236d431cae34598da311a398a8..61d43146c4341f582006c081d1a5a9869ddebff7 100644 --- a/src/code/irrat.lisp +++ b/src/code/irrat.lisp @@ -81,7 +81,7 @@ ;;; Exponential and Logarithmic. (def-math-rtn ("__ieee754_exp" %exp) 1) (def-math-rtn ("__ieee754_log" %log) 1) -(def-math-rtn "log10" 1) +(def-math-rtn ("__ieee754_log10" %log10) 1) (def-math-rtn ("__ieee754_pow" %pow) 2) #-(or x86 sparc-v7 sparc-v8 sparc-v9) diff --git a/src/lisp/GNUmakefile b/src/lisp/GNUmakefile index c557d3be43f8d8d90c497d81b57aadfc2027ffcb..d0d61043eb95c2b1b9831d5f21d210fbf4bd67a8 100644 --- a/src/lisp/GNUmakefile +++ b/src/lisp/GNUmakefile @@ -12,6 +12,7 @@ FDLIBM = k_sin.c k_cos.c k_tan.c s_sin.c s_cos.c s_tan.c sincos.c \ e_acosh.c s_asinh.c e_atanh.c \ e_atan2.c \ e_rem_pio2.c k_rem_pio2.c \ + e_log10.c \ setexception.c SRCS = lisp.c coreparse.c alloc.c monitor.c print.c interr.c \ diff --git a/tests/trig.lisp b/tests/trig.lisp index 861a298a9cea386c9e38afdd4b48f2c498a891f6..cdebe397399be326b43fe34dc421fcbf06ea9376 100644 --- a/tests/trig.lisp +++ b/tests/trig.lisp @@ -1006,3 +1006,24 @@ (assert-true (ext:float-nan-p (kernel:%atan *qnan*))) (kernel::with-float-traps-masked (:invalid) (assert-true (ext:float-nan-p (kernel:%atan *snan*))))) + +(define-test %log10.exceptions + (:tag :fdlibm) + ;; %log10(2^k) = k + (dotimes (k 23) + (assert-equalp k + (kernel:%log10 (float (expt 10 k) 1d0)))) + (assert-error 'division-by-zero + (kernel:%log10 0d0)) + (assert-error 'floating-point-invalid-operation + (kernel:%log10 -1d0)) + (assert-true (ext:float-nan-p (kernel:%log10 *qnan*))) + (assert-equal ext:double-float-positive-infinity + (kernel:%log10 ext:double-float-positive-infinity)) + (kernel::with-float-traps-masked (:divide-by-zero) + (assert-equal ext:double-float-negative-infinity + (kernel:%log10 0d0)) + (assert-equal ext:double-float-negative-infinity + (kernel:%log10 -0d0))) + (kernel::with-float-traps-masked (:invalid) + (assert-true (ext:float-nan-p (kernel:%log10 -1d0)))))