Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
21 Views

how to assign a double double variable?

Jump to solution

if a double variable is assigned, d0 need to be tailed.

real(8)::a
a=1.2d0

Now, a higher precision variable need to be assigned, what is tailed?

real(16)::b
b=1.2??

 

0 Kudos

Accepted Solutions
Highlighted
Valued Contributor III
21 Views
real(16)::b
b=1.2_16

! or better

integer, parameter :: rk = 16
real(rk) :: b
b = 1.2_rk

 

View solution in original post

0 Kudos
5 Replies
Highlighted
Valued Contributor III
22 Views
real(16)::b
b=1.2_16

! or better

integer, parameter :: rk = 16
real(rk) :: b
b = 1.2_rk

 

View solution in original post

0 Kudos
Highlighted
Black Belt Retired Employee
21 Views

Better still (and more portable):

Integer, parameter :: qk = selected_real_kind(30)
real(qk)::b
b=1.2_qk

 

0 Kudos
Highlighted
Beginner
21 Views

Steve Lionel (Ret.) wrote:

Better still (and more portable):

Integer, parameter :: qk = selected_real_kind(30)
real(qk)::b
b=1.2_qk

 

thx!!

Then, what forms of functions such as dsqrt is?

0 Kudos
Highlighted
Black Belt
21 Views

仁义 许. wrote:
 Then, what forms of functions such as dsqrt is? 

DSQRT is a specific function (more than one function for one purpose, one for each type of argument). Fortran77 and earlier versions of Fortran had plenty of such specific functions. Fortran 90 and later versions provide generic functions, so that you can use a single function name regardless of the type of the argument and function value. It is recommended that you do not use specific functions such as DSQRT in new code.

0 Kudos
Highlighted
Black Belt Retired Employee
21 Views

RIght - just use the generic SQRT.

0 Kudos