[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing C floating point data type in MCL



At  4:26 PM 8/26/93 -0800, Ray Lam wrote:
>Hi,
>                                I'm looking for a function simular to "%get-long" but it will work on 
>a ptr to a floating point number in C. I was looking into the
>ff-source.lisp
>file and found the function "%get-x2float". Can anyone tell me what that
>function does?

(ccl::%get-x2float ptr)
  Reads a 10-byte IEEE extended float from ptr and returns it as an
MCL 8-byte float.

(ccl::%float2x float ptr)
  Stores the 8-byte MCL float as a 10-byte IEEE extended float at ptr.

(defun %safe-get-double (ptr)
  ; Reads an 8-byte IEEE double float from ptr and returns an 8-byte MCL float
  (let ((float (ccl::%copy-float 1.0)))
    (ccl::%get-double ptr float)
    float))

(ccl::%put-double flt ptr)
  Stores the 8-byte MCL float as an 8-byte IEEE double float at ptr.

>
>          Also, Can anyone tell me how a FLOAT datatype in C is represented in a
>32  and 64 bits? Where is the exponent and where is the mantissa. Thanks in
>advance.

Don't know. Get the Apple Numerics book or find a specification of
IEEE floating point.