Skip to content

Commit 1ba499c

Browse files
authored
specialfunctions: generalize gamma precision (#969)
2 parents def840d + f9d999f commit 1ba499c

File tree

4 files changed

+147
-177
lines changed

4 files changed

+147
-177
lines changed

Diff for: example/specialfunctions_gamma/example_gamma.f90

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
program example_gamma
2-
use stdlib_kinds, only: dp, int64
2+
use stdlib_kinds, only: sp, dp, int64
33
use stdlib_specialfunctions_gamma, only: gamma
44
implicit none
55

66
integer :: i
77
integer(int64) :: n
88
real :: x
99
real(dp) :: y
10-
complex :: z
11-
complex(dp) :: z1
10+
complex(sp) :: z
1211

1312
i = 10
1413
n = 15_int64
1514
x = 2.5
1615
y = 4.3_dp
1716
z = (2.3, 0.6)
18-
z1 = (-4.2_dp, 3.1_dp)
1917

2018
print *, gamma(i) !integer gives exact result
2119
! 362880
@@ -32,6 +30,4 @@ program example_gamma
3230
print *, gamma(z)
3331
! (0.988054395, 0.383354813)
3432

35-
print *, gamma(z1)
36-
! (-2.78916032990983999E-005, 9.83164600163221218E-006)
3733
end program example_gamma

Diff for: example/specialfunctions_gamma/example_log_gamma.f90

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
program example_log_gamma
2-
use stdlib_kinds, only: dp
2+
use stdlib_kinds, only: sp, dp
33
use stdlib_specialfunctions_gamma, only: log_gamma
44
implicit none
55

66
integer :: i
77
real :: x
88
real(dp) :: y
9-
complex :: z
10-
complex(dp) :: z1
9+
complex(sp) :: z
1110

1211
i = 10
1312
x = 8.76
1413
y = x
1514
z = (5.345, -3.467)
16-
z1 = z
15+
1716
print *, log_gamma(i) !default single precision output
1817
!12.8018274
1918

@@ -29,7 +28,4 @@ program example_log_gamma
2928

3029
!(2.56165648, -5.73382425)
3130

32-
print *, log_gamma(z1)
33-
34-
!(2.5616575105114614, -5.7338247782852498)
3531
end program example_log_gamma

0 commit comments

Comments
 (0)