[REBOL] Re: 32 bit - dword values
From: ptretter:norcom2000 at: 15-Jan-2001 19:55
Hi Elan,
We were at the time looking for a solution to convert dword values to an
ip address for the IRCBOT we were creating. Kinners came up with the
following solution:
dec2tuple: func [long] [
to-tuple reduce [
to-integer long / 16777216
to-integer long / 65536 // 256
to-integer long / 256 // 256
to-integer long // 256
]
]
This function is so useful I thought RT should put this into /Core. How
many people could use this? answer: alot! Thanks for your feedback.
Paul Tretter
EFNET #rebolgod
----- Original Message -----
From: "Elan" <[rebol--techscribe--com]>
To: <[rebol-list--rebol--com]>
Sent: Monday, January 15, 2001 5:39 PM
Subject: [REBOL] Re: 32 bit - dword values
> Hi Paul,
>
> try
>
> >> to integer! #7fffffff ;- seven f's
>
> and then try
>
> >> to integer! #8fffffff ;- again seven f's
>
> and
>
> >> to integer! #ffffffff ;- eight f's
>
> In short, REBOL supports SIGNED 32 bit integers.
>
> Hope this helps
>
> Elan
>
> Paul Tretter wrote:
> >
> > How do we handle 32 bit numbers when trying to convert them. It seems
that special precautions must be taken to prevent math overflow errors. Can
someone from RT tell us how we should handle these issues. For example if I
do a to-hex 5555555555 I get an error: