I am running a mac os x 10.7 system I am writing a fortran code which compiles, however, whenever I run my code (./file.out) all I receive in return is the message "Illegal Instruction". I have tried messing with my code and I continue to receive this message. Any help with this would be great. My code is as follows:(adsbygoogle = window.adsbygoogle || []).push({});

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

PROGRAM HomeWorkOne_ProbOne

IMPLICIT NONE

! Computes an estimation of the exponential function, pi, and the Euler Constant

! Declare all variables

INTEGER(8) :: n

INTEGER, PARAMETER :: max = 100

REAL(8), DIMENSION (max + 2) :: f, DF, p, pi, gamma, e

! Set initial values of variables to approximate

pi = 0.0

gamma = 0.0

e = 0.0

! Calculation of n factorial set equal to f(n)

DO n=1, max

f(1) = 1.0

f(n+1) = f(n)*n

END DO

! Calculation of (2n+1)!! set equal to DF(n)

DO n=1, (2*max+1)

DF(1) = 1.0

DF(2) = 1.0

DF(n+2) = DF(n+1)*(2*n+1)

END DO

! Calculation of F/DF set equal to p(n)

DO n=0, max

p(n+1) = f(n+1)/DF(n+1)

END DO

! Loop that will calculate approximation values

DO n=1, max

e(n+2) = (1.0/f(n+1)) + e(n+1)

gamma(n+2) = gamma(n+1) + ((1.0/n)-LOG((n+1.0)/n))

pi(n+2) = p(n+1) + pi(n+1)

END DO

PRINT *, "Approximate values of:"

PRINT *, "e =", e(32)

PRINT *, "gamma =", gamma(32)

PRINT *, "Pi =", pi(32)

PRINT *, "Actual values of :"

PRINT *, "e =", 2.71828182

PRINT *, "gamma =", 0.57721566

PRINT *, "Pi =", 3.14159265

END PROGRAM HomeWorkOne_ProbOne

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Illegal Instruction Error in Mac terminal

**Physics Forums | Science Articles, Homework Help, Discussion**