The enbase fucntion is to restrictive - probably should be expanded to
include integer dataype and number datatype to handle values greater than
255.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, July 20, 2000 9:18 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: ENBASE bug


Hello [EMAIL PROTECTED],


On 21-Jul-00, [EMAIL PROTECTED] wrote:

> Does anyone know if enbase/base refinement has a bug.  When I do the
> following:
>
> a: "2"
> enbase/base a 2
>
> I get:
>
>>> "00110010"
>
> This must be a bug or I need more understanding.

It isn't a bug, it's the ASCII value of the letter #"2" being converted.
2's ASCII value is 50 - doing a bit of binary math on the above:
2^1 + 2^4 + 2^5 = 2 + 16 + 32 = 50.

If you want the binary representation of the number 2, you can do it like
this:

   enbase/base form to-char 2 2

not very pretty I must admit, and it only work for values in the range
[0..255]


Best regards
Thomas Jensen

Reply via email to