[REBOL] Re: How to obtain a 64-bit IEEE754 representation of a decimal number
From: atruter:labyrinth:au at: 3-Feb-2004 0:32
Hi Ladislav,
> convert: func [
> x
> /local y
> ] [
> y: make struct! compose/deep [x [(type?/word x)]] reduce [x]
> third y
> ]
OK, this one has me stumpted. For us mere mortals, could you explain:
>> help y
Y is a struct of value: make struct! [x [decimal!]] [0.2]
>> first y
== [x [decimal!]]
>> second y
== [0.2]
>> third y
== #{9A9999999999C93F}
how and why this works, in particular where "third y" comes from? Also,
how does one reverse the conversion (i.e. get 0.2 from #{9A9999999999C93F}
)?
I assume this is another useful spinoff from the rounding project? ;)
Regards,
Ashley<