You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unnecessary operation removed from map() in WMath.cpp (espressif#6218)
* Unneccesary Operation Removed
(A) extra operation not needed and incorrect:
wrong by 0.5 but happens to be thrown out
( delta * dividend + (divisor / 2) ) / divisor
delta * dividend divisor
= ---------------- + -----------
divisor 2 * divisor
= delta * dividend / divisor + 1/2
(B) check first before doing other computations
(C) changed to rise/run, easier for future maintainer
since it's closer to equation of a line
(D) before: mult, shift, add, div, add
now: mult, div, add
(E) error message easier to trace where thrown
* Update WMath.cpp
forgot to change variable name
0 commit comments