Skip to content
Snippets Groups Projects
Commit dd986228 authored by ram's avatar ram
Browse files

Made all the C stubs be exported and maybe-inline. Put the generic

functions under (space 0) so that the stubs will be inline expanded.
Changed some uses of INTEGER-DECODE-FLOAT to FLOAT-SIGN, since only
the sign was being used.
Note that EXPT is broken, since (expt -2.0 0.5) should be a complex,
not 0.
parent 17375846
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/irrat.lisp,v 1.3 1990/07/31 17:22:14 wlott Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/irrat.lisp,v 1.4 1990/10/18 02:56:15 ram Exp $
;;;
;;; This file contains all the irrational functions. Actually, most of the
;;; work is done by calling out to C...
......@@ -27,12 +27,15 @@
(let ((function (intern (concatenate 'simple-string
"%"
(string-upcase name)))))
`(def-c-routine (,name ,function) (double-float)
,@(let ((results nil))
(dotimes (i num-args (nreverse results))
(push (list (intern (format nil "ARG-~D" i))
'double-float)
results))))))
`(progn
(proclaim '(maybe-inline ,function))
(export ',function)
(def-c-routine (,name ,function) (double-float)
,@(let ((results nil))
(dotimes (i num-args (nreverse results))
(push (list (intern (format nil "ARG-~D" i))
'double-float)
results)))))))
(eval-when (compile load eval)
......@@ -78,6 +81,10 @@
;;;; Power functions.
;;; Let the C stubs be opportunistically inline expanded.
;;;
(proclaim '(optimize (space 0)))
(defun exp (number)
"Return e raised to the power NUMBER."
(number-dispatch ((number number))
......@@ -316,19 +323,11 @@
"Return the arc tangent of Y if X is omitted or Y/X if X is supplied."
(if xp
(if (and (zerop x) (zerop y))
(multiple-value-bind
(mag exp sign-x)
(integer-decode-float (float x))
(declare (ignore mag exp))
(if (plusp sign-x)
y
(multiple-value-bind
(mag exp sign-y)
(integer-decode-float (float y))
(declare (ignore mag exp))
(if (minusp sign-y)
(- pi)
pi))))
(if (plusp (float-sign (float x)))
y
(if (minusp (float-sign (float y)))
(- pi)
pi))
(number-dispatch ((y real) (x real))
(((foreach fixnum bignum ratio single-float)
(foreach fixnum bignum ratio single-float))
......@@ -376,3 +375,4 @@
"Return the hyperbolic arc tangent of NUMBER."
(log (* (1+ number) (sqrt (/ (- 1 (* number number)))))))
(proclaim '(optimize (space 1)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment