Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
sci.math.*
»
sci.math.numanalysis
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
forcing intel floating registers to use 64bit arithmetic
Replies:
5
Last Post:
Feb 3, 2013 10:48 PM




Re: forcing intel floating registers to use 64bit arithmetic
Posted:
Jan 16, 2013 5:33 PM


>>>>> "TS" == Tom Stockfisch <tomstockfisch@gmail.com> writes:
TS> I need to force all double precision calculations to proceed TS> strictly in 64bit  no 80bit
The easiest way is to use sse math, which is the default when compiling for 64 bit mode.
To force the x87 calculations to be done in 64bits, you need to edit the x87 fp control word. Bits 8 and 9 (the PC field) control precision.
The (binary) value 11 is the default and uses 80 bits. Value 10 specifies 64 bits. Value 00 specifies 32 bits.
So you want to clear bit 8 (aka store original and (not 0x100)).
The FLDCW, FRSTOR and FXRSTOR instructions load the control word from memory; the FSTCW, FNSTCW, FSAVE, FNSAVE and FXSAVE store the word to memory and the FINIT initializes it to the default value.
The docs say that PC only affects FADDx, FSUBx, FMULx, FDIVx and FSQRT, so it probably will not guarantee the same results you get from sse math or other processors.
In the end it is almost always simpler and better to forget the legacy x86 mode entirely and only use the x86_64 mode.
JimC  James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6



