- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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