[REBOL] Re: integers and sizes
From: gjones05:mail:orion at: 18-Apr-2001 18:16
From: "Travis Watkins"
> I fear that this may be a bug:
>
> Integer? 10000000005
> false (this is correct because you only use 4 bytes to represent an
integer)
> integer? 2000000001
> true
>
> integer? (10000000005 / 5)
> false
> (note, this is 2000000001, the value which was true before)
>
> apparently any number which was at one point associated with a value
greater than an integer is not an integer, even when reduced to a
sufficently small number.
> Note: Win98 system
Well, this does get interesting. To continue with your example:
a: 2000000001
b: 10000000005 / 5
type? a ;integer!
type? b ;decimal!
a = b ;true, as it should be
same? a b ;true, as I guess it is
strict-equal? a b ;false, ahhh, I feel better
to-integer b ; 2000000001
type? b ;decimal!, wow, that is interesting
to-decimal a ;2000000001
type? c ;integer!
It is interesting that sometimes REBOL "leaves" it as it was (a decimal or
an integer), despite trying to coerce it. I can't tell if this is a bug or
a feature, but I could imagine circumstances where it might trip up
programming logic.
Thanks.
--Scott Jones