Re: Getting to the floating point bits
Thanks Martin…
> On Jan 13, 2017, at 12:31 , Martin Simmons <martin@lispworks.com> wrote:
>
> Yes, converting using the FLI is probably the best option.
>
> E.g.
>
> (fli:with-dynamic-foreign-objects ((value :double :initial-element 1d0))
> (fli:dereference value :type :int64))
Just to be sure… The FLI:DEREFERENCE creates a new integer, doesn’t it?
> LispWorks doesn't enable floating point traps, so signalling DIVISION-BY-ZERO
> for (/ 0.0 0.0) is conforming. See the definition of
> FLOATING-POINT-INVALID-OPERATION.
Point taken.
All the best
Marco
>
> --
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
>
>
>>>>>> On Thu, 12 Jan 2017 23:14:14 +0100, Marco Antoniotti said:
>>
>> Nope. INTEGER-DECODE-FLOAT does not help. Looks like you have to go down to the FLI to actually have a look at the bits.
>>
>> Apart from that, reading through some IEEE 745 literature, it appears to me that LW is mistaken in the following case.
>>
>> CL-USER 21 > (/ 0.0 0.0)
>> Error: Division-by-zero caused by / of (0.0 0.0).
>>
>> I believe that the correct condition to signal here is a FLOATING-POINT-INVALID-OPERATION, not a DIVISION-BY-ZERO.
>>
>> Cheers
>> —
>> MA
>>
>>
>>
>>
>>
>>
>>> On Jan 11, 2017, at 13:18 , Marco Antoniotti <marcoxa@cs.nyu.edu> wrote:
>>>
>>> Hi Raymond
>>>
>>> I thought of INTEGER-DECODE-FLOAT but I am not really sure whether it’d work. Probably it would. Let me run some tests.
>>>
>>> Thanks
>>>
>>> Marco
>>>
>>>
>>>> On Jan 11, 2017, at 07:54 , Raymond Wiker <rwiker@gmail.com> wrote:
>>>>
>>>> Would integer-decode-float work for you?
>>>>
>>>> On Wed, Jan 11, 2017 at 2:10 AM, Jingtao Xu <jingtaozf@gmail.com> wrote:
>>>> Hi Marco,
>>>>
>>>> As I know lispworks provide API for variable type ref to a single
>>>> array,that is typed-aref-vector.
>>>>
>>>> So you can create a vector with float type then access it with
>>>> (unsigned-byte 8) to access each bit in this float.
>>>>
>>>> I once used this way to get each byte of a 64 bit integer.
>>>> http://www.lispworks.com/documentation/lw70/LW/html/lw-1349.htm#29034
>>>>
>>>>
>>>>
>>>> On Wed, Jan 11, 2017 at 6:07 AM, Marco Antoniotti <marcoxa@cs.nyu.edu> wrote:
>>>>> Hi
>>>>>
>>>>> I am looking at porting (don’t ask why) a bit of LW to IEEEFP-TESTS.
>>>>>
>>>>> I was trying to find functions to actually to the bits of a floating point in LW. In CMUCL/SBCL you have SINGLE-FLOAT-BITS and DOUBLE-FLOAT-{LOW,HIGH}-BITS.
>>>>>
>>>>> Is there something similar deep down in the SYS package or could I just go ahead and assume a 32 bits “standard” layout and do the obvious bit bashing?
>>>>>
>>>>> Also, is there any particular incantation that LW needs to make a {SHORT,SINGLE,DOUBLE}-FLOAT from a (SIGNED-BYTE 32) or a (UNSIGNED-BYTE 32)
>>>>> ?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Cheers
>>>>> --
>>>>> Marco Antoniotti
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Lisp Hug - the mailing list for LispWorks users
>>>>> lisp-hug@lispworks.com
>>>>> http://www.lispworks.com/support/lisp-hug.html
>>>>
>>>> _______________________________________________
>>>> Lisp Hug - the mailing list for LispWorks users
>>>> lisp-hug@lispworks.com
>>>> http://www.lispworks.com/support/lisp-hug.html
>>>>
>>>
>>> --
>>> Marco Antoniotti
>>>
>>>
>>>
>>> _______________________________________________
>>> Lisp Hug - the mailing list for LispWorks users
>>> lisp-hug@lispworks.com
>>> http://www.lispworks.com/support/lisp-hug.html
>>
>> --
>> Marco Antoniotti
>>
>>
>>
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
--
Marco Antoniotti
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html