Hi Ashley,

>>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} 
>)?
>
>  
>
This is a library interface, which is documented in:

    http://www.rebol.com/docs/library.html

, where I found the informations needed to write the above function as 
well as:

    http://www.compkarori.com/vanilla/display/peek_and_poke.r

reverse-conversion: func [
    x [binary!]
    type [word!]
] [
    y: make struct! compose/deep [x [(type)]] none
    change third y x
    y/x
]

Usage:

    reverse-conversion #{9A9999999999C93F} 'decimal! ; == 0.2

>I assume this is another useful spinoff from the rounding project? ;)
>  
>

Not exactly, it is mostly independent.

>Regards,
>
>       Ashley
>  
>
-L

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to