I just found this at the beginning of primitives.lisp, make_DF already
exists and it is used in compiler.boot:

============================================
;;; Making constant doubles
(defun |make_DF|(x e)
    (let ((res (read-from-string (format nil "~D.0d~D" x e))))
         res)
)

(defmacro |mk_DF|(x e) (|make_DF| x e))
============================================

I don't understand anything anymore :)

- Greg

Le jeu. 14 nov. 2024 à 21:56, Grégory Vanuxem <[email protected]> a écrit :
>
> 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

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dYsoD%2B2QK17A12cC4Gn%2BR_MMQ9U2Spmyher6C_4NxvcSg%40mail.gmail.com.

Reply via email to