Hello,
I want to convert an integer variable into a selected_real_kind but I am not sure how to do this. Can anyone help me? The code looks like this:
integer, parameter :: rk = selected_real_kind(15,307) !in this case double precision
integer :: a = 10
real(rk) :: b
b = 1._rk/a !here I get zero (integer division)
b = 1._rk/10._rk !here I get 0.1
b = 1._rk/(a)_rk !here I get a compiler error (gfortran)
My question is: what is the equivalent to dble(a) for a general kind conversion?
I want to convert an integer variable into a selected_real_kind but I am not sure how to do this. Can anyone help me? The code looks like this:
integer, parameter :: rk = selected_real_kind(15,307) !in this case double precision
integer :: a = 10
real(rk) :: b
b = 1._rk/a !here I get zero (integer division)
b = 1._rk/10._rk !here I get 0.1
b = 1._rk/(a)_rk !here I get a compiler error (gfortran)
My question is: what is the equivalent to dble(a) for a general kind conversion?