Subject: Math Library Testing.
To: None <tech-userlevel@sun-lamp.cs.berkeley.edu,>
From: J.T. Conklin <conklin@ngai.kaleida.com>
List: current-users
Date: 02/08/1994 13:53:32
I now have access to a i386 without a math coprocessor, and was able
to test the math library I've been working on.
The machine is running NetBSD 0.9, so Wolfgang's fix to the emulator
is not present. I do not know what effect it would have to the
results.
I am using the math regression tests from P.J. Plauger's "The Standard
C Library". The tests are not as comprehensive as they might be, but
they do highlight the fact that the old math library has serious
problems with i386 machines without math coprocessors.
Here is the output of the tests with the old library:
./tmath1
assertion "ceil (-5.1) == -5.0" failed: file "tmath1.c", line 30
assertion "ceil (-4.9) == -4.0" failed: file "tmath1.c", line 32
assertion "ceil (4.9) == 5.0" failed: file "tmath1.c", line 34
assertion "ceil (5.1) == 6.0" failed: file "tmath1.c", line 36
assertion "floor (-5.1) == -6.0" failed: file "tmath1.c", line 40
assertion "floor (-4.9) == -5.0" failed: file "tmath1.c", line 42
assertion "floor (4.9) == 4.0" failed: file "tmath1.c", line 44
assertion "floor (5.1) == 5.0" failed: file "tmath1.c", line 46
HUGE_VAL prints as Inf
./tmath2
assertion "approx (acos (-rthalf), 3.0 * piby4)" failed: file "tmath2.c", line 29
assertion "approx (acos (rthalf), piby4)" failed: file "tmath2.c", line 31
assertion "approx (asin (-rthalf), -piby4)" failed: file "tmath2.c", line 35
assertion "approx (asin (rthalf), piby4)" failed: file "tmath2.c", line 37
./tmath3
assertion "approx (sqrt (0.5), rthalf)" failed: file "tmath3.c", line 58
assertion "approx (sqrt (2.0), 1.0 / rthalf)" failed: file "tmath3.c", line 60
assertion "approx (sqrt (144.0), 12.0)" failed: file "tmath3.c", line 61
Here is the output of the same tests with the fdlibm derived library:
./tmath1
HUGE_VAL prints as Inf
SUCCESS testing <math.h>, part 1
./tmath2
assertion "approx (asin (-rthalf), -piby4)" failed: file "tmath2.c", line 35
assertion "approx (asin (rthalf), piby4)" failed: file "tmath2.c", line 37
./tmath3
SUCCESS testing <math.h>, part 3
Note that all three tests pass with "flying colours" on machines that
have a FPU; And that neither library was compiled with any special FPU
support (it exists, but it is not enabled since the emulator doesn't
support some of the instructions).
--jtc
------------------------------------------------------------------------------