[comp.lang.ada] Floating point attribute verification Program

nyberg@AJPO.SEI.CMU.EDU (Karl Nyberg) (03/11/88)

This program was submitted to info-ada.  It was deemed too large to pass
through the vraious mail networks (something like 37K bytes).  I have
separated the program into the file ~ftp/public/infoada/float.ada and
float.note.  The file float.note is attached.

-- Karl --

Subject: Floating point attribute verification.

Attached you will find a program that will verify the correctness of
the values returned by floating point type attributes.  This program
was written within the framework of the Ada Europe Numerics Working
Group, and I thank the group members for there input and advise.

Attributes are crucial when an attempt is made to write a portable
problem.  And it is, of course, essential that the values returned
are correct.  But even with my current, limited, knowledge I know
that for every floating point type attribute there is at least one
compiler system that returns the wrong value!  And only a minority (2)
of the compiler systems tested so far (9) return (apparently) correct
values in all cases.  But I know from other sources that one of these
2 compilers gives wrong results in a number of other cases, and the
other compiler gives wrong results when a port to a different machine
is used.

It is clear that a program for the verification of the attributes
would be appropriate in the validation suite.  The problem is that
validation programs should be portable to all machines and compilers,
however weird they are.  But this program relies on some properties
of the hardware, and I do not know of a method to avoid this.
The most important property this program requires is that multiplication
of a positive floating point number by the machine radix either yields
an overflown result (which might have exponent wrap-around) or the
correct result.  I know of at least one binary machine where multiplication
of a floating point number by two might loose precision (though there is
not yet an Ada compiler on it).  So this program will fail on that
machine without any doubt.

As it is not feasible to put this program in the validation suite, I
intend to have this program put to as wide a public as possible.
I would appreciate if you, when you compile and execute this program,
would mail the results to me.  My addresses are in the header page
of the output.  Also feel free to communicate any problems or errors
you encounter with the program, so that I am able to adjust the program
accordingly (no program is perfect).

dik t. winter, cwi, amsterdam, nederland
Internet: dik@cwi.nl
Bitnet  : dik@mcvax (this is a nickname, do NOT use hamcwi6, it will fail)
UUCP    : ....uunet!dik@cwi.nl (or something like that)