Re: The history of the word 'format' in 754...
On 2010-10-20 01:08:28 -0700, Dan Zuras Intervals wrote:
> Actually, when I originally suggested decorated intervals my
> inspiration was an old 754 implementation in Forth.
>
> As Forth operates only with a stack & has no concept of
> global variables, it was necessary for them to tag every
> floating-point number with a set of modes (5 bits) & flags
> (another 5). They only implemented 32-bit floating-point
> numbers so the combined data structure was 42 bits.
>
> As far as I know this style of implementation was unique.
> But it had obvious advantages in that every floating-point
> value carried its exception history with it. And JUST the
> exception history for that number. Whatever else happened
> could not contaminate that result.
>
> In the modern world this would also have advantages when it
> comes to parallelism. Independent calculations are freed
> from the choke point of any synchronization interlocks
> associated with global state. And the exception state that
> is local to any given value is the exception state of THAT
> value & no other.
Yes, this has clear advantages, but also drawbacks. For instance,
the exception information could be lost, so that the programmer
must be very careful. Consider the following code, with inputs x
and y and output r (using a C-like syntax).
r = x < sqrt(y) ? x : y;
If y is negative (so that the result makes no sense), this will
remain undetected by testing the flags of r, unless the language
specifies to propagate the flags to r. I wonder what you decided
for Forth, but in C, this would be more complex as one has more
than expressions, e.g.:
if (x < sqrt(y))
r = x;
else
s = y;
Of course, with such languages, one could design comparison operators
to ensure that such exceptions are explicitly taken into account:
binary comparisons should no longer exist and such operators should
have 3 clauses: if-true, if-false and if-comp-with-nan. To avoid
awkward syntax, this could require a language modification.
So, in IA, how could this be handled with decorations?
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)