Problems with converting floats to integers
Hi
As I could understand from my 2 year Common Lisp
experience, first result of TRUNCATE function was always integer, but recently I
encountered a problem when result was atomagically converted back to float.
I am not sure that problem lies in the TRUNCATE function. There are
no arithmetic operations between place of TRUNCATE and place where argument
must be integer, only LET bindings and passing to function call.
Simplification of my code looks like:
(defun caller-function (fn)
(let ((float-var (get-float)))
(funcall fn (truncate float-var))))
(let ((float-var (get-float)))
(funcall fn (truncate float-var))))
(let ((fn nil))
(defun init-fn ()
(setf fn
(lambda (fixnum-arg)
(do-something-with fixnum-arg))))
(defun caller-loop ()
(mp:process-run-function "Caller loop" '()
(lambda ()
(loop
(caller-function fn))))))
(defun init-fn ()
(setf fn
(lambda (fixnum-arg)
(do-something-with fixnum-arg))))
(defun caller-loop ()
(mp:process-run-function "Caller loop" '()
(lambda ()
(loop
(caller-function fn))))))
In real code FN is not closure member, it is stored
in slot, CALLER-LOOP and INIT-FN started inside CAPI message processing
thread.
First question is "Can TRUNCATE result be float ?" (I
couldn't find answer in Hyperspec).
Second - "Is problem in multithreading or so ?
(Compiler bug ?)"
Thanks in advance
Lisper