3 ms·
And in most cases your "floating point" calculations are tied to sensor values with known precision. If you have a pressure value from a sensor with a precisio
by Symmetry 7y ago
And in most cases your "floating point" calculations are tied to sensor values with known precision. If you have a pressure value from a sensor with a precision of 2 mBar then it often make sense to just do calculations in fixed point in those terms. But make sure you document your structs for units!
- roland35 7y agoyes fixed point is a good alternative. Floating point can get you in trouble if you are testing for equality too, i.e. pressure == 2 mBar. I've seem people always put a threshold around it, so something like pressure <= 2.1 mbar AND pressure >= 1.9 mbar