Skip to content

Instantly share code, notes, and snippets.

@aptavout
Created October 21, 2014 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aptavout/f2303b6a44f9e38167fe to your computer and use it in GitHub Desktop.
Save aptavout/f2303b6a44f9e38167fe to your computer and use it in GitHub Desktop.
Calculate natural logarithm
c
c evaluate the natural logarithm e
c
c variables
c 123456 a
c fln the value of the natural logarithm
c iterm the current term in the summation
c next the next number in a factorial operation
c fdenom the value of the current factorial
c
c234567
fln = 1
iterm = 1
10 if (iterm .lt. 15) goto 20
goto 30
20 next = iterm - 1
fdenom = iterm
50 if (next .le. 1) goto 40
fdenom = fdenom * next * 1.
next = next - 1
goto 50
40 fln = fln + (1. / fdenom)
write (6, 70) iterm, fdenom, fln
70 format ('TERM: ', I2, ' DENOM: ', F15.0, ' ln so far: ', F20.8)
iterm = iterm + 1
goto 10
30 write (6, 60) fln
60 format ('THE VALUE OF THE NATURAL LOGARITHM (LN) IS ', F20.8)
stop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment