Mailing List Archive: 49091 messages

## [REBOL] Rebol values (continuing the discusion)

### From: lmecir::mbox::vol::cz at: 18-Apr-2005 6:39

```
Hi,

>DISCLAIMER: If you do not want to be confused about Rebol language, stop
>
The most useful informations (IMO) are the points 1 to 3 below:

1) The confusion already exists, because some statements heavily depend
on the chosen terminology and both terminologies are used on this ML.

2) There is one practical difference I want to underline:

The "implementation-dependent terminology" tries to describe the
properties of "just one implementation". There is at least one
implementation, for which almost every property described this way is
wrong, while the implementation-independent description remains correct.

uses the implementation independent terminology and contains my answer
to: "What are Rebol values?" question as well as the complete proof that
The sameness of Rebol values doesn't depend on implementation.

4) now to discuss Romano's points:

....

>So i must conclude that "1 is equal to every other 1" only in an human
>head, not in the real world
>
....
:-)
...

>My thesis: "Rebol number are not mathematical number"
>
>The proof:
>
>x: 1 / 2e305 ;== 5E-306
>x = 0 ;== false
>y: x + 1 - 1 ;== 0.0
>y = 0 ;== true
>
There are two ways to prove you wrong. The first one is "oversimplified"
and uses an implementation dependent (i.e. wrong) type of reasoning:

There are at least two implementations of Rebol numbers in computers.
The first one is little-endian and the second one is big-endian.
Therefore your above statement has got no sense without saying which
implementation you have got in mind.
This is the reason why I put the
smile above.

Now a serious (and lengthy) one:

Let's define a subset of all real numbers as follows: a real number X is
an IEEE754 number if X is either 0 or if there is a real number S called
sign, a real number M called significand and a real number E called
exponent such that X = S * M * (2 ** E), where E is an integer number
such that -1023 <= E <= 1022 , S is either 1 or -1 and M is a real
number such that there is 52-element sequence of binary digits (0 or 1,
bits for short) b1,b2,..., b52, such that M = 1 + (b1 / (2 ** 1)) + (b2
/ (2 ** 2)) + ... + (b52 / (2 ** 52)).

Note: all operations in the above definition are "normal" "mathematical"
operations as defined for real numbers.

Now let's define an IEEE754-round function "working" on a subset of real
numbers as follows:
- for X >= ((2 ** 1022) * (2 - (2 ** -52) + (2 ** -53))) the
IEEE754-round function isn't defined
- for 0 <= X < (2 ** -1023) we define that IEEE754-round X will be zero
- for (2 ** -1023) <= X < ((2 ** 1022) * (2 - (2 ** -52) + (2 ** -53)))
IEEE754-round X will be the maximal of all IEEE754 numbers Z such that
abs(X - Z) <= abs (X - U) for every IEEE754 number U.
- similarly for negative values X.

As the last step let's define IEEE754+, IEEE754-, IEEE754/ as follows:
IEEE754+ (X,Y) = IEEE754-round (X + Y), etc.

Now we see this:

i) IEEE754 numbers *are* real numbers (we defined them that way).

ii) the IEEE754+, IEEE754- and IEEE754/ operators "exhibit" the
behaviour you described above.

>You could answer that the different behaviour of Rebol number is only an
>implementation detail,
>
>but if this is true, it is also true that
>decimal! are the same of integer! (the difference is only an
>implementation detail)
>
There is exactly the same situation in mathematics too - cf.
construction
of the natural numbers in the ZF set theory, the
construction
of integers, the "construction" of rationals and the
construction
of reals. The "original" integers "created" this way
aren't set-theoretically identical with "rational integers" or with
real integers
.

> and that Java number, Visual Basic number, and C
>number are the same (the difference are only implementation details), so
>the is no real difference between this languages and Rebol about number.
>
Actually, there is a lower difference between a double precision C
number and a Rebol decimal! number on a PC than between two Rebol
representations of 1.0 on computers with different endianness, but it
doesn't matter when we are describing the sameness of Rebol numbers as I
dared
to point out.

>Well if you think as this, you should also agree on these thesis:
>
>Two strings in Rebol can be the same or cannot be the same.
>
>x: "house"
>same: reduce [x x]
>not-same: reduce [copy x copy x]
>
>But in my head the word "house" is only one, so this behaviour is
>implementation-dependent.
>
(and implementation independent) description of Rebol properties with
respect to this subject.

One point still remains to be made:

There is not a complete counterpart of the above article written in an
implementation dependent
style and there never will be such a
counterpart, because the implementation dependent terminology is
intrinsically inconsistent. A notion: "distinct but identical"
illustrates well the trouble one gets into when using it.

-L
```