I would expect that (1.0f + smallest float subnormal) > 1.0f when the Floating Point unit is set to Round Up.

Here is some C++ code:
#include <limits>
#include <cstdio>
#include <cfenv>

int main(int, char**) {
    std::fesetround(FE_UPWARD);
printf("%.32g\n", std::numeric_limits<float>::denorm_min() + 1.0f);
    return 0;
}

Execution on my machine yields:
clang++ --std=c++11 test_denormal.cc && ./a.out
1.00000011920928955078125

Here is the same code in D:
void main(string[] args)
{
    import std.math;
    FloatingPointControl fpctrl;
    fpctrl.rounding = FloatingPointControl.roundUp;
    writefln("%.32g", float.min_normal + 1.0f);
}

Execution on my machine yields:
dmd -run test_denormal.d
1

Did I miss something?

Reply via email to