Using std.math: FloatingPointControl.enableExceptions
Shriramana Sharma via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 10 22:28:09 PST 2015
Hello. I'm trying to figure out how to use
FloatingPointControl.enableExceptions. Upon enabling severeExceptions I
would expect the division by zero to be signaled, but neither do I get a
SIGFPE nor does ieeeFlags show the exception having been signaled. What am I
doing wrong?
import std.stdio;
import std.math;
void main()
{
FloatingPointControl fc;
fc.enableExceptions(fc.severeExceptions);
real a = 1.0 / 0.0;
writeln(ieeeFlags.divByZero);
}
--
Shriramana Sharma, Penguin #395953
More information about the Digitalmars-d-learn
mailing list