An infinity was generated by division by zero
The result cannot be represented exactly, so rounding occurred.
A machine NaN was generated.
An infinity was generated by overflow
A zero was generated by underflow
1 static void func() { 2 int a = 10 * 10; 3 } 4 pragma(inline, false) static void blockopt(ref real x) {} 5 real a = 3.5; 6 // Set all the flags to zero 7 resetIeeeFlags(); 8 assert(!ieeeFlags.divByZero); 9 blockopt(a); // avoid constant propagation by the optimizer 10 // Perform a division by zero. 11 a /= 0.0L; 12 assert(a == real.infinity); 13 assert(ieeeFlags.divByZero); 14 blockopt(a); // avoid constant propagation by the optimizer 15 // Create a NaN 16 a *= 0.0L; 17 assert(ieeeFlags.invalid); 18 assert(isNaN(a)); 19 20 // Check that calling func() has no effect on the 21 // status flags. 22 IeeeFlags f = ieeeFlags; 23 func(); 24 assert(ieeeFlags == f);
IEEE exception status flags ('sticky bits')
These flags indicate that an exceptional floating-point condition has occurred. They indicate that a NaN or an infinity has been generated, that a result is inexact, or that a signalling NaN has been encountered. If floating-point exceptions are enabled (unmasked), a hardware exception will be generated instead of setting these flags.