Why does trunc() return 0?
Unit test fails even though values are equal I was stuck in the above problem. While trying to solve that, I wrote the following listing. I expect it to keep two digits after the decimal point. #include "simulation.hpp" #include <cstdio> typedef double real; double truncate_(double f) { return std::trunc(f * 100.0); } int main() {… Read More Why does trunc() return 0?