Hacker Newsnew | comments | show | ask | jobs | submit login

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.



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: