Is there any automatic compiler-based or library methods for detecting NaNs? I mean, if the compiler is outputting code that it knows is going to be set in memory to NaN, why isn't it giving me at least a compiler warning? Is that some sort of "NP complete" can't-fix issue or something?
I mean, I can pass NaN to std.math.round() and it doesn't fire off an exception or anything. It compiles fine even though it's impossible-as-compiled to be correct. (Unless my absurd intention was to find the rounded value of NaN.) Instead, I'm stuck finding out where the NaN started, from a trail of destruction of values destroyed by NaN propogation. Why not stop it at its source?
Even dscanner won't flag this code!
import std.stdio;
import std.math;
int main()
{
float x;
writeln(x);
writeln(round(x));
return 0;
}