ARTICLE AD BOX
Surely, a number of ways are at a developer's disposal to reduce a rounding error of 1.78814e-07 variable assignment to 0.000000. What is best practice?
My best solution is to include a method as such:
#include <cstdlib> #include <cmath> float returnZero(float inValue) { if(std::abs(inValue) < 0.000001) return 0.000000; else return inValue; }However, I'm curious about best practice. I'm not concerned with stdout or printf.
