Movement against float.init being nan
Adam D Ruppe
destructionator at gmail.com
Sat Aug 20 12:53:28 UTC 2022
On Saturday, 20 August 2022 at 12:02:17 UTC, Nick Treleaven wrote:
> Then compare it with real.nan - smaller types will be promoted
> to real:
It isn't about size, but rather the nans can come in different
forms. Consider:
---
void main() {
float f = 7.0;
f /= 0;
import core.stdc.stdio;
printf("%d\n", *cast(int*)&f);
if(f is float.init)
printf("nan\n");
}
---
That's a different nan than the float.init pattern. I don't know
if you can start with a float.init and come up with a different
pattern though, but i expect you can.
More information about the Digitalmars-d
mailing list