[net.micro.mac] Aztec C problem with pow

zaccone@psuvax1.UUCP (Rick Zaccone) (10/19/86)

The following tests were done with version 1.06H.1 of the Manx Aztec C
compiler. The compilations were done

cc test.c
ln test.o -lm -lc

Here are the problems.
-----------------------------------------------------------------------
The function exp() does not work properly.  Condiser the following
example:
     
#include <math.h>
#include <stdio.h>
main()
{
        double x,z;
     
        printf("Enter x: ");
        scanf("%E", &x);
        z = exp(x);
        printf("exp(x) is %f:n", z);
}
     
Here are two sample runs with this program:
Enter x: 1
exp(x) is 2.330483   [Correct answer is 2.718281828]
     
Enter x: 10
exp(x) is 18988.393529   [Correct answer is  22026.465]
     
Note that is problem also manifests itself in pow().  Consider the
following program:
     
#include <math.h>
#include <stdio.h>
main()
{
        double x,y,z;
     
        printf("Enter x: ");
        scanf("%E", &x);
        printf("Enter y: ");
        scanf("%E", &y);
        z = pow(x, y);
        printf("z is %f:n", z);
}
Enter x: 1.25
Enter y: 15
z is 30.158702   [Correct answer is 28.4217]

-----------------------------------------------------------------------
Manx claims that pow() and exp() "were not created properly".
     
To correct the problem extract the sources for exp() and pow() from
math.arc using arcv.  Recompile them, and install them into m.lib
using libutil.  I'm not sure if there is a problem in any of the other
math libraries.  The above examples will work correctly after
recompiling pow() and exp().

-- 
Rick Zaccone                   Pennsylvania State University
CSNET: zaccone@penn-state      BITNET: zaccone@psuvax1
UUCP:  {akgua,allegra,burdvax,ihnp4}!psuvax1!zaccone

fry_b@husc4.harvard.edu (david fry) (10/20/86)

In article <2310@psuvax1.UUCP> zaccone@psuvax1.UUCP (Rick Zaccone) writes:
[...]
>The function exp() does not work properly.  Condiser the following
>example:

	I have been pretty much displeased with the floating point libraries
provided with Aztec C.  They barely perform any better than MS-BASIC on
some benchmarks and are destroyed by True Basic, so I know that something
better is possible.
	Has anyone rewritten the floating point libraries?  I think they
could be made faster by recoding the routines in assembly, and perhaps
using better routines, but I don't know any assembly.
	Has anyone heard any news about Manx doing this?

	Thanks in advance.

David Fry				fry@huma1.harvard.EDU
Department of Mathematics		fry@harvma1.bitnet
Harvard University			fry%huma1@harvsc4.bitnet
Cambridge, MA  02138			...!harvard!huma1!fry