File: example_gamma.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 614 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
program example_gamma
  use stdlib_kinds, only: sp, dp, int64
  use stdlib_specialfunctions_gamma, only: gamma
  implicit none

  integer :: i
  integer(int64) :: n
  real :: x
  real(dp) :: y
  complex(sp) :: z

  i = 10
  n = 15_int64
  x = 2.5
  y = 4.3_dp
  z = (2.3, 0.6)

  print *, gamma(i)              !integer gives exact result
! 362880

  print *, gamma(n)
! 87178291200

  print *, gamma(x)              ! intrinsic function call
! 1.32934034

  print *, gamma(y)              ! intrinsic function call
! 8.8553433604540341

  print *, gamma(z)
! (0.988054395, 0.383354813)

end program example_gamma