Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
27434 Discussions

how to assign a double double variable?

仁义_许_
Beginner
318 Views

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
1 Solution
andrew_4619
Honored Contributor II
318 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

5 Replies
andrew_4619
Honored Contributor II
319 Views
real(16)::b
b=1.2_16

! or better

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

 

Steve_Lionel
Black Belt Retired Employee
318 Views

Better still (and more portable):

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

 

仁义_许_
Beginner
318 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?

mecej4
Black Belt
318 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.

Steve_Lionel
Black Belt Retired Employee
318 Views

RIght - just use the generic SQRT.

Reply