On Fri, 11 Jun 2004 10:27:51 +0200, David Lennartsson
<[EMAIL PROTECTED]> wrote:
> I have not
>bothered to dig deeper and I have no idea of how to get and set the FPU 
>control word in the wrapper. Is there
>a compiler macro or does it have to be done with assembler?

Which compiler are you using?  The minGW gcc has a function
_controlfp() to get and set the control word.  Here's the code that R
uses to check for changes during a DLL load and fix them.

Here is the function R uses to set things up in the first place:

void Rwin_fpset()
{
    _fpreset();
    _controlfp(_MCW_EM, _MCW_EM);
    _controlfp(_PC_64, _MCW_PC);
}

And here is the code R  uses to preserve the control word across a DLL
load:

rcw = _controlfp(0,0) & ~_MCW_IC;  /* Infinity control is ignored */
_clearfp();
tdlh = LoadLibrary(path);
dllcw = _controlfp(0,0) & ~_MCW_IC;
if (dllcw != rcw) {
    _controlfp(rcw, _MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC);
    ...

Duncan Murdoch

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to