RosettaCodeData/Task/Extreme-floating-point-values/D/extreme-floating-point-values-2.d
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

13 lines
444 B
D

import std.math: FloatingPointControl;
void main() {
// Enable hardware exceptions for division by zero, overflow
// to infinity, invalid operations, and uninitialized
// floating-point variables.
FloatingPointControl fpc;
fpc.enableExceptions(FloatingPointControl.severeExceptions);
double f0 = 0.0;
double y1 = f0 / f0; // generates hardware exception
// unless it's compiled with -O)
}