On Wednesday, 27 December 2017 at 14:14:42 UTC, Benjamin Thaut
wrote:
On Wednesday, 27 December 2017 at 13:40:28 UTC, rumbu wrote:
Is that normal?
It computes the difference between float.max and the next
smaller reprensentable number in floating point. The difference
printed by the program is
On Wednesday, 27 December 2017 at 13:40:28 UTC, rumbu wrote:
Is that normal?
use std.math;
float f = float.max;
f += 1.0;
assert(IeeeFlags.overflow) //failure
assert(f == float.inf) //failure, f is in fact float.max
On the contrary, float.max + float.max will overflow. The
behavior is the same
Is that normal?
use std.math;
float f = float.max;
f += 1.0;
assert(IeeeFlags.overflow) //failure
assert(f == float.inf) //failure, f is in fact float.max
On the contrary, float.max + float.max will overflow. The
behavior is the same for double and real.