[comp.sys.atari.st] floating point capabilities.

t68@nikhefh.UUCP (04/28/87)

------------------------------------------------------

Even though the savage benchmark may not be typical for the speed of the
individual floating point operations it does test the care that went into
the design of the built in functions. So it is not at all useless.
So some extra numbers :
Single precision:
	Prospero Fortran	~15 sec		error 2.7e+02
	(Absoft                  20.8		error 3.7e+02)
	Apollo DN300 (68010 8Mhz)11.1		error 4.4E+02

Double precision:

	prospero		~50sec		error 3.1e-07
	(Absoft                  67.6		error 1.7e-07)
	Apollo DN300		 30.4		error 8.8e-07

For reference I have hacked up the Absoft library and reprogrammed the
addition, multiplication, division, sin, cos, tan, exp, alog, sqrt, atan.
This gives something closer to the capabilities of the 68000 :
in single precision :
	Hacked version		  7.03		error 2.4e+01

I didn't get around to the double precision yet.
The upshot of the whole story is that while some libraries may be 'the best'
they are far from ideal. I think that the limit for the 68000 is within a
factor 2 of the 7 seconds. The error comes mainly from the tangent which is
called very often with an argument close to pi/2 after which pi/2-x causes
the main instability. A better test would be:

	a=1./tan(atan(exp(-alog(sqrt(a*a)))))+1.0

During this exercise I found several errors in the Absoft library.
First all rounding is programmed wrong! In the manual they claim to round
but in case of a tie it is quasi random whether they round up or down.
In practise when the first bit is 1 they only test whether the next bit is zero
to define a tie. The net result is an average truncation of 1/8 of a bit.
( Of course I had a program that was sensitive to this ......mumble mumble )
Next the complex root is numerically unstable. Solving a quadratic equation
seems to be very difficult.
There are also some very elegant tricks I must say, but on the whole most
functions can be programmed with one or two multiplications fewer.
The multiplication can be 10% faster and the division can be improved by
a whopping factor of two.
I hope this puts the benchmark numbers in perspective.
(BTW the prospero is currently the fastest of the commercially available
floating point libraries. This does not prove that it is the best package
as a whole. Hint: Try compiling nested parentheses and study exponentials).

Jos Vermaseren,
T68@nikhefh.uucp