Grégory Vanuxem
unread,Nov 14, 2024, 3:57:17 PM11/14/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas...@googlegroups.com
Hello,
I was looking at the DoubleFloat domain and its internal
implementation and noticed this:
in src/interp/spad.lisp, it's a small file, at the end:
================================================
;************************************************************************
; SYSTEM COMMANDS
;************************************************************************
(defun |fin| ()
(SETQ *EOF* 'T)
(THROW 'SPAD_READER NIL))
(defun QUOTIENT2 (X Y) (values (TRUNCATE X Y)))
(defun INTEXQUO(X Y)
(multiple-value-bind (quo remv) (TRUNCATE X Y)
(if (= 0 remv) quo nil)))
(defun DIVIDE2 (X Y) (multiple-value-call #'cons (TRUNCATE X Y)))
(defun |makeSF| (mantissa exponent)
(FLOAT (/ mantissa (expt 2 (- exponent))) 0.0d0))
[...]
==================================================
My primary concern is on makeSF which is only used in float.spad to
convert a Float to a DoubleFloat, whereas in src/lisp/primitives.lisp
we have:
==================================================
;; Before version 1.8 Clozure CL had buggy floating point optimizer, so
;; for it we need to omit type declarations to disable optimization
#-(and :openmcl (not :CCL-1.8))
(defmacro DEF_DF_BINOP (name op)
`(defmacro ,name (x y) `(the double-float (,',op (the double-float ,x)
(the double-float ,y)))))
#+(and :openmcl (not :CCL-1.8))
(defmacro DEF_DF_BINOP (name op) `(defmacro ,name (x y) `(,',op ,x ,y)))
(DEF_DF_BINOP |add_DF| +)
(DEF_DF_BINOP |mul_DF| *)
(DEF_DF_BINOP |max_DF| MAX)
(DEF_DF_BINOP |min_DF| MIN)
(DEF_DF_BINOP |sub_DF| -)
(DEF_DF_BINOP |div_DF| /)
[...]
===================================================
So I wonder if makeSF can be renamed to make_DF to use the same naming
scheme and eventually moved to primitives.lisp. In fact maybe other
functions/macros also.
Though?
- Greg