Please sign in to comment.
libfpvm: use C operator precedence
Placing each operator at its own precedence level subtly alters the evaluation order for +, -, *, and /, which can produce unexpected results where rounding errors are considered. More significantly, the precendence of % differs from that used in C (and various other languages). For example, 2 * 3.1 % 2 with C precedence would be (2 * 3.1) % 2 = 6.2 % 2 = 0.2 (unlike C's %, our % if really fmod) By giving % higher precedence than *, we get 2 * (3.1 % 2) = 2 * 1.1 = 2.2 instead. I don't know if this difference is intentional, e.g., required for compatibility with Milkdrop. But it does at least look suspicious. - Werner
- Loading branch information...