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

Problem using 64 bits resolution in real(8) variable using FPCW$64 switch.

axejodongenergy_dk
154 Views
Dear forum

I am developing some code that calculates a Jacobiant with very flat gradients, so I'll need a better machine precision. I use the following code which would give me 64 bits of precision, but it does not, unfortunately. I work in IA32 environment:

Thanks in advance!

Axel Ohrt Johansen

Code:

SUBROUTINE fpprecis()

USE IFPORT
USE DFLIB

INTEGER(2) control, holdcontrol, newcontrol
REAL(8) A,EPSMAC

CALL GETCONTROLFPQQ(control)

! Clear any existing precision flags.

holdcontrol = IAND(control, NOT(FPCW$MCW_PC))

newcontrol = IOR(holdcontrol, FPCW$64)

! Set precision to 64 bits.

CALL SETCONTROLFPQQ(newcontrol)

EPSMAC=1.0D0
100 EPSMAC=EPSMAC/2.0D0
A=EPSMAC+1.0D0
IF(A.NE.1.0D0) GO TO 100
EPSMAC=2.0D0*EPSMAC

Write(6,*) EPSMAC
END
0 Kudos
1 Solution
Steven_L_Intel1
Employee
154 Views

You will need to compile with /arch:IA32 to get this to work. The default as of 11.0 is to use SSE2 code for floating point which does not support extended double. If you are using Visual Studio, set the property Fortran > Code Generation > Enable Enhanced Instruction Set to "No enhanced instruction sets".

View solution in original post

1 Reply
Steven_L_Intel1
Employee
155 Views

You will need to compile with /arch:IA32 to get this to work. The default as of 11.0 is to use SSE2 code for floating point which does not support extended double. If you are using Visual Studio, set the property Fortran > Code Generation > Enable Enhanced Instruction Set to "No enhanced instruction sets".
Reply