Skip to content

Instantly share code, notes, and snippets.

@Ansarina Ansarina/InternalExternal.f90 Secret
Created Oct 24, 2015

Embed
What would you like to do?
PROGRAM func
EXTERNAL CTN
INTRINSIC SIN, COS
REAL::angle=0.785 !...pi/4
REAL::sine,cosine,tangent
CALL TRIG(angle,SIN,sine)
WRITE(*,*) 'SIN(0.785)=',sine
CALL TRIG(angle,COS,cosine)
WRITE(*,*) 'COS(0.785)=',cosine
CALL TRIG(angle,CTN,cotangent)
WRITE(*,*) 'COTAN(0.785)=',cotangent
PAUSE
END PROGRAM func
SUBROUTINE TRIG(X,F,Y)
Y = F(X)
RETURN
END SUBROUTINE TRIG
FUNCTION CTN(X)
CTN = COS(X)/SIN(X)
RETURN
END FUNCTION CTN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.