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

Maximum Float Range with IFORT compiler?

ulsterjam
Beginner
1,181 Views
Hi all,

Quick question:

What is the largest floating point range I can achieve with the ifort v9.1 compiler including any compiler tricks, switches etc?

Thanks in advance,

Tim Stitt
0 Kudos
5 Replies
TimP
Honored Contributor III
1,181 Views

If you want it as quick as possible, consult the documents, and avoid tricks which depend on your (not divulged) platform. How about this page in the docs?

REAL(KIND=16) Representation

REAL(16) (same as REAL(KIND=16)) data occupies 16 contiguous bytes stored in IEEE-style X_floating format.

......

The value of data is in the approximate range: 6.4751751194380251109244389582276465524996Q-4966 to 1.189731495357231765085759326628007016196477Q4932

0 Kudos
Steven_L_Intel1
Employee
1,181 Views
Tim is correct that the REAL(16) type has the widest range. No switches are required to use this type. Do be aware that the REAL(16) type has no hardware instruction support, so all arithmetic operations are carried out through library calls, meaning that performance will be significantly lower than for REAL(8) or REAL(4). Therefore, if performance is critical, you should limit your use of REAL(16) to only those parts of the program where the wider range or precision is needed.
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,181 Views

Isn't that the 10 byte range of FPU x87? Wouldn't the software simulation package provide the full 16 byte range? mantissa ~113 digits, exponent -16381 to 16384?

In section titled Model for Real Data it seemed to imply IEEE X_floating was supported rather than 10 bytes usedout of 16 bytes reserved. In looking at the command line options it is not clear how or if you can select between the 10/16 (FPU Tbyte) or 16/16 (full simulation) format.

Could someone comment on this?

Jim

0 Kudos
Steven_L_Intel1
Employee
1,181 Views

Intel Fortran has no support for "10 byte floating". None. The documented range Tim quotes is for IEEE-style quad precision with a 15-bit exponent and 113-bit mantissa.

Intel C++ "long long float" is the x87 10-byte float. It is not interoperable with Intel Fortran's REAL(16).

0 Kudos
joseph-krahn
New Contributor I
1,181 Views
For a given KIND, you can use F95 intrinsics like HUGE() to get details about numeric representations. Also, beware that REAL(KIND=16) varies among compilers, with trade-offs between precision and exponent range. Some of these were probably implented before IEEE defined a quad type, but there will always be some variations because Fortran is designed to adapte to specialized hardware.

It's a bit surprising that there is no KIND=10 for compatibility with the C long double.
0 Kudos
Reply