Mail Archives: djgpp/1992/12/04/03:18:28
Hi everyone,
I am having probelms with a simple fortran program enclosed below.
It works fine when I compile it with a native fortran compiler.
But when I use f2c to translate it to C and use DJGCC to compile
and link the resulting code, I get exception 117. Someone has
any ideas what is happening?
cut here
=====================================================================
PROGRAM TEST2
IMPLICIT REAL*8 (A-H,O-Z)
EPSMCH = DMACH(1)
DWARF = DMACH(2)
GIANT = DMACH(3)
PRINT*,'epsmch = ',EPSMCH
PRINT*,'dwarf = ',DWARF
PRINT*,'giant = ',GIANT
STOP
END
DOUBLE PRECISION FUNCTION DMACH(JOB)
INTEGER JOB
C
C JOB IS 1, 2 OR 3 FOR EPSILON, TINY AND HUGE, RESPECTIVELY.
C
DOUBLE PRECISION EPS,TINY,HUGE,S
C
EPS = 1.0D0
10 EPS = EPS/2.0D0
S = 1.0D0 + EPS
IF (S .GT. 1.0D0) GO TO 10
EPS = 2.0D0*EPS
C
S = 1.0D0
20 TINY = S
S = S/16.0D0
IF (S*1.0 .NE. 0.0D0) GO TO 20
TINY = (TINY/EPS)*100.0
HUGE = 1.0D0/TINY
C
IF (JOB .EQ. 1) DMACH = EPS
IF (JOB .EQ. 2) DMACH = TINY
IF (JOB .EQ. 3) DMACH = HUGE
RETURN
END
- Raw text -