- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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??

1 Solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

real(16)::b b=1.2_16 ! or better integer, parameter :: rk = 16 real(rk) :: b b = 1.2_rk

Link Copied

5 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

real(16)::b b=1.2_16 ! or better integer, parameter :: rk = 16 real(rk) :: b b = 1.2_rk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Better still (and more portable):

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

仁义 许. wrote:

Then, what forms of functions such asdsqrtis?

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

RIght - just use the generic SQRT.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page