Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Quadruple precision for ifort (Mac)

nalgenbottle
Beginner
1,616 Views
Could anybody tell me how I can use quadruple precision in fortran90/95 code?
Is there also any special treatment such as 1.0D0 for double precision?
Also, if there are any special ways to compile the file, please let me know that too.

Please assume I am a very beginner of fortran90/95.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,616 Views
Yes, you can. Declare variables as REAL(16). For example:

REAL(16) :: Q

For constants, use a suffix _16 such as 1.0_16.

Better, actually, would be to declare a named constant for the quad precision kind like this:

INTEGER, PARAMETER :: QUAD = SELECTED_REAL_KIND(32)

and then use QUAD instead of 16. For example:

REAL(QUAD) :: Q
Q = 3.14_QUAD

When calling intrinsic functions such as SQRT and SIN, just use the generic name and don't try to use a kind-specific name such as QSQRT.

Please note that quad precision arithmetic is performed using software and not the CPU directly, so it will be much slower than single or double precision. You may want to use quad precision only in those parts of the algorithm that need the extra precision.
0 Kudos
nalgenbottle
Beginner
1,616 Views
Thanks.

Let me ask another question.
When I want to use some integers with quadruple precision value, how should I treat the integer?
For instance, when I 'm using double precision, we can do...

dx = 2.0D0/DBLE(n)


Is there anything like"DBLE" for Quadruple precision?


0 Kudos
Steven_L_Intel1
Employee
1,616 Views
Use REAL(N,QUAD) - this converts the argument N to a REAL of kind QUAD. (Assumes you have defined the PARAMETER constant QUAD.)
0 Kudos
Reply