- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
The intrinsic function DCMPLX does not change to 128 bit precision when using compiler option /double_size:128. It seems like DCMPLX(x,y) is equal to CMPLX(x,y,kind=8) instead of CMPLX(x,y,kind=KIND(1.D0)). The problem is illustrated in the enclosed program (the same result in IVF11 and IVF12). Is this a bug or a consequence of the fortran standard?
Program Qtst
double complex z
double precision x
call xxx( dcmplx(1.D0,0.D0))
x=0.213D0
z = DCMPLX( x, 0.D0 )
write(*,*) x,z
end
subroutine xxx(x)
double complex x
write(*,*) x
end
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting.
DCMPLX is not a standard intrinsic - it is an extension. I would expect /double_size to affect it - CMPLX/DCMPLX seems to be unusual here, since the option does affect SQRT, for example. Escalated as DPD200173396.
DCMPLX is not a standard intrinsic - it is an extension. I would expect /double_size to affect it - CMPLX/DCMPLX seems to be unusual here, since the option does affect SQRT, for example. Escalated as DPD200173396.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Upon further reading, and discussion with the developers, we determined that this is not a bug.
DCMPLX is explicitly documented as returning COMPLEX(KIND=8) and is not affected by /double-size.
CMPLX is standard but the standard specifies that in the absence of a KIND= specifier, the result is complex of default real kind. So without KIND=, CMPLX is not affected by /double-size either but it is affected by /real-size.
The suggestion I have for you is to replace uses of DCMPLX with CMPLX (x,y,KIND=(KIND(1.0D0)). This will do what you want.
DCMPLX is explicitly documented as returning COMPLEX(KIND=8) and is not affected by /double-size.
CMPLX is standard but the standard specifies that in the absence of a KIND= specifier, the result is complex of default real kind. So without KIND=, CMPLX is not affected by /double-size either but it is affected by /real-size.
The suggestion I have for you is to replace uses of DCMPLX with CMPLX (x,y,KIND=(KIND(1.0D0)). This will do what you want.

Reply
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