Interval Arithmetic

ponce via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 1 05:03:10 PDT 2015


On Thursday, 1 October 2015 at 11:40:28 UTC, Marco Leise wrote:
>
> Note that the FP control word is per thread and any external 
> code you call or even buggy interrupt handlers could change or 
> reset it to defaults. Known cases include a faulty printer 
> driver and Delphi's runtime, which enables FP exceptions to 
> throw exceptions on division by 0. Just saying this so if it 
> ever happens you have it in the back of your mind. Against 
> interrupt handlers you probably cannot protect, but when 
> calling other people's code it would be best not depend on what 
> the FP control word is set to on return. `FloatingPointControl` 
> is nice here, because you can temporarily set the rounding mode 
> directly for a block of FP instructions where no external 
> libraries are involved.

I have a RAII struct to save/restore the FP control word.
It also handle the SSE control word which unfortunately exist.

https://github.com/p0nce/dplug/blob/master/plugin/dplug/plugin/fpcontrol.d






More information about the Digitalmars-d-learn mailing list