Thread View: net.micro.mac
2 messages
2 total messages
Started by Rick Zaccone
Sun, 19 Oct 1986 15:12
Aztec C problem with pow() and exp(), and a fix
Author: Rick Zaccone
Date: Sun, 19 Oct 1986 15:12
Date: Sun, 19 Oct 1986 15:12
64 lines
2307 bytes
2307 bytes
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
Re: Aztec C problem with pow() and exp(), and a fix
Author: david fry
Date: Mon, 20 Oct 1986 15:17
Date: Mon, 20 Oct 1986 15:17
20 lines
1494 bytes
1494 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads