Setting the FPU control word?
Neil Vice
psgdg at swiftdsl.com.au
Mon Mar 10 08:57:20 PDT 2008
"Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message
news:fr3k2f$30b5$1 at digitalmars.com...
> Anyone know how to translate these instructions to D? (specifically
> DMD/Win flavor of D, but GDC/Win also appreciated if different):
>
> http://www.cs.cmu.edu/~quake/robust.pc.html
>
> --bb
Something along the following lines seems to do the trick, by which I mean
it compiles in 2.012 though I believe the syntax should be compatible with
D1:
enum FPPrecision : short
{
Single = 4210,
Double = 4722
}
void setFPCtrlWord(FPPrecision precision)
{
asm
{
fldcw precision;
}
}
Having said that it might be advisable to use 'fstcw' and bitwise operations
to alter the specifics of the control-word that you require:
http://www.website.masmforum.com/tutorials/fptute/fpuchap3.htm#fldcw
More information about the Digitalmars-d-learn
mailing list