-
Notifications
You must be signed in to change notification settings - Fork 1
/
fortran_arb_test.f90
42 lines (34 loc) · 1.33 KB
/
fortran_arb_test.f90
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
34
35
36
37
38
39
40
41
42
program drive_arb
! compute bessel function using Arb
! by Kris Kuhlman, with help from Frederik Johansson
use, intrinsic :: iso_c_binding, only : C_FLOAT128_COMPLEX, C_FLOAT128
implicit none
interface
function arb_J(nu,z) bind(c,name="arb_J") result(J)
use, intrinsic :: iso_c_binding, only : C_FLOAT128_COMPLEX, C_FLOAT128
complex(C_FLOAT128_COMPLEX), intent(in), value :: z
real(C_FLOAT128), intent(in), value :: nu
complex(C_FLOAT128_COMPLEX) :: J
end function arb_J
end interface
interface
function arb_Y(nu,z) bind(c,name="arb_Y") result(Y)
use, intrinsic :: iso_c_binding, only : C_FLOAT128_COMPLEX, C_FLOAT128
complex(C_FLOAT128_COMPLEX), intent(in), value :: z
real(C_FLOAT128), intent(in), value :: nu
complex(C_FLOAT128_COMPLEX) :: Y
end function arb_Y
end interface
complex(C_FLOAT128_COMPLEX) :: z
real(C_FLOAT128_COMPLEX), parameter :: PIOV4 = atan(1.0_C_FLOAT128_COMPLEX)
real(C_FLOAT128) :: nu
integer :: i
print *, 'max exponent C_FLOAT128',maxexponent(nu)
print *, 'min exponent C_FLOAT128',minexponent(nu)
print *, 'spacing(0.0_QP)',spacing(0.0_C_FLOAT128)
do i=1,8
z = cmplx(i*PIOV4, 2*i*PIOV4, kind=C_FLOAT128_COMPLEX)
nu = (i+2)*PIOV4
print *, i,z,nu,arb_J(nu,z),arb_Y(nu,z)
end do
end program drive_arb