Mail Archives: djgpp/1993/05/24/08:59:02
Hi
I have had a strange result trying to calculate cos() function
with f2c + gcc
A result has been provided by IBM PC differs from it done by
as IBM/VM as VAX/VMS on a power !!!
Does anybody know how could one work around this problem?
Thanks in advance?
Valery
===================== Cut here =======================
PROGRAM TEST
DOUBLE PRECISION PI,X,Z,Y,S
PARAMETER (PI = 3.14159 26535 89793 24D0)
DATA Z /-20.5/
X=PI*Z
Y=COS(X)
write(*,*) 'COS(X)= ',Y
STOP
END
===================== Cut here =======================
COS(X)= 7.83951354E-15 computed by IBM PC 486/25 MSDOS v.5.0 + DJGPP
7.34169098E-16 computed by IBM/VM
7.34169098E-16 computed by VAX/VMS
============== This is the C equivalent of above ===============
===================== Cut here =======================
/* test_t.f -- translated by f2c (version of 23 April 1993 18:34:30).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* Main program */ MAIN__()
{
/* Initialized data */
static doublereal z = -20.5;
/* Builtin functions */
double cos();
/* Local variables */
static doublereal x, y;
x = z * 3.14159265358979324;
y = cos(x);
printf(" cos(x) = %e",y);
} /* MAIN__ */
/* Main program alias */ int test_ () { MAIN__ (); }
- Raw text -