|
|
|
|
|
by roryokane
5049 days ago
|
|
An alternative workaround to writing `float f = 0` in languages without NaN: float f;
bool thingIsFoo = condition1; // store the result…
if (thingIsFoo)
f = 7;
// ... code ...
if (thingIsFoo && condition2) // and explicitly depend on it later
++f;
But this causes an extra `&&` to be computed at runtime, so it seems NaNs are still better for this case. |
|