Skip to content

specialfunctions: generalize gamma precision #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions example/specialfunctions_gamma/example_gamma.f90
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
program example_gamma
use stdlib_kinds, only: dp, int64
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 :: z
complex(dp) :: z1
complex(sp) :: z

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

print *, gamma(i) !integer gives exact result
! 362880
Expand All @@ -32,6 +30,4 @@ program example_gamma
print *, gamma(z)
! (0.988054395, 0.383354813)

print *, gamma(z1)
! (-2.78916032990983999E-005, 9.83164600163221218E-006)
end program example_gamma
10 changes: 3 additions & 7 deletions example/specialfunctions_gamma/example_log_gamma.f90
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
program example_log_gamma
use stdlib_kinds, only: dp
use stdlib_kinds, only: sp, dp
use stdlib_specialfunctions_gamma, only: log_gamma
implicit none

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

i = 10
x = 8.76
y = x
z = (5.345, -3.467)
z1 = z

print *, log_gamma(i) !default single precision output
!12.8018274

Expand All @@ -29,7 +28,4 @@ program example_log_gamma

!(2.56165648, -5.73382425)

print *, log_gamma(z1)

!(2.5616575105114614, -5.7338247782852498)
end program example_log_gamma
Loading
Loading