www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/12/04/03:18:28

Date: Thu, 3 Dec 1992 23:20:26 -0800 (PST)
From: Hassan Saleh <salehh AT atlantis DOT CS DOT ORST DOT EDU>
Subject: f2c and exception 117
To: djgpp AT sun DOT soe DOT clarkson DOT edu

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019