For example, according to IEEE-754 specification if we work with 32bit floating point numbers (floats in D) then the following pseudo code prints 'Works'.

F32 f = 16777216.0f;
F32 f2 = f + 0.1f;
if is_the_same_binary_presentation(f, f2)
  Print("Works");

As I understand D does not guarantee this. Please confirm if it's correct.

One clarification:

In D the following should always print 'Works'
float f = 16777216.0f;
float f2 = f + 1.0f;
if (f == f2)
 writeln("Works");

I asked more about this case:
float f = 16777216.0f;
if (f == f + 1.0f)
 writeln("Works");

Although all operands are 32bit FP the result is not guaranteed to be equal to the result for FP32 computations as specified by IEEE-754.

Reply via email to