The code below demonstrates this
#include <float.h>
#include <stdint.h>
#pragma fenv_access(on) // apparently ineffective
int main(int argc, char **argv)
{
uint32_t cw;
cw = _controlfp(0,0); // cw = 0x0008001f
cw = _controlfp(_PC_24,_MCW_PC); // cw = SAME!
cw = _controlfp(_PC_53,_MCW_PC); // cw = STILL THE SAME!
return 0;
}
I need to set the working precision, as a lot of old mesh generation code depends on it. Before migrating to 64 bit, I threw in fstcw [cur_cw] etc… and all was well. However, since vs2010 does not support inline assembly for 64 bit targets, it seems the only workable solution I have is to create a separate .asm file for this purpose. Is there yet another magic not-so-well documented compiler option I don’t know about that will make _controlfp cooperate?
Are you sure that the old x87 FPU is being used? I would expect all floating point to be performed using SSE instructions by default; on x86_64, there’s no good reason not to use SSE.