CayenneLPP
CayenneLPP copied to clipboard
Enhancement: "businesslike conduct" round to reduce data error from 0.09 to 0.05 (~50% accuracy enhancement)
hi,
we have seen some problems when it comes to rounding (in our case for temp measurements).
in the current code the float temp just gets cut after the 1st decimal place, which is very inaccurate!
float celsius; int16_t val = celsius * 10;
in this case the error is at worst 0.09. almost 0.1° off.
instead the float temp should be businesslike conduct rounded (in germany we call this "Kaufmännisches Runden") before chopping off the last diget, like so:
float celsius; int16_t val = round(celsius * 10);
in this case the error is @ max. 0.05° off. which is much more accurate for professional use. of cause other values can benefit from this kind of correction, too.