Hacker News new | ask | show | jobs
by bArray 734 days ago
At this point I've fixed enough bugs similar to this to do:

    float ts = 1.0f / (float)FRAMERATE;
I would still go further in modern times (C++23) and use the compiler to ensure fixed width types [1]:

    #define _float std::float32_t 
    _float ts = 1.0f / (_float)FRAMERATE;
Annoyingly though printing these numbers requires a cast which is not ideal.

[1] https://en.cppreference.com/w/cpp/types/floating-point