Setting the FPU control word?
Bill Baxter
dnewsgroup at billbaxter.com
Mon Mar 10 18:40:25 PDT 2008
Neil Vice wrote:
> "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;
> }
> }
Ooh, thanks!
> 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
Hmm, yeh. Those crazy computational geometry guys always assume you're
writing a command line program whose only purpose in life is to
calculate a Delaunay triangulation or something. Oh, you want to use
this algorithm in a what?? an application?? What's that?
True to form, that page from Shewchuk says nothing about how to put
things back the way you found them when you're done with robust
predicate happy-fun-time.
That page you linked to was great though. Thanks.
--bb
More information about the Digitalmars-d-learn
mailing list