Rounding of native function math.muldiv should be documented
Created by: stephanemagnenat
Native function math.muldiv
may produce rounding errors, for instance 2/3 is 0 rather than 1. It might be interesting for most end-user applications for math.muldiv
to actually round correctly the numbers. To resolve this problem, one should:
-
Write unit tests exhibiting the problem. -
Implement rounding (https://github.com/aseba-community/aseba/blob/master/vm/natives.c#L821), by testing the sign and pre-adding half of the divisor to the dividend.