[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dealing with the binary representation of floats.
>>>>> "Brian" == "Brian F Dennis" <xjam@CS.Berkeley.EDU> writes:
Brian> Is there any easy or standard way to take an IEEE floating
Brian> point number in Clisp and turn it into it's bit representation
Brian> for transmission through IPC? Ditto for receiving a bit pattern
Brian> and turning it into a float.
INTEGER-DECODE-FLOAT and SCALE-FLOAT might do what you want.
Another approach is to use the FFI with IPC-ready C library routines that
accept floating point numbers. For instance, some low-level glue
to pack a various types with PVM library routines:
(:arguments (val (c-ptr double-float)) (nitem int) (stride int))
(:arguments (fptr (c-ptr double-float) :out :alloca)
(defun unpack-double ()
(multiple-value-bind (ret-code a-double) (raw-upkdouble 1 1)
(if (zerop ret-code) a-double (check-return-code ret-code))))