Skip to content
Myr

Fix off-by-one in modulo operator (#3486)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Fabian Fleischer · committed by GitHub · parent 22361cf · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/builtin.c+1 added-1 removed
354 unmodified lines
355 return type_error2(a, b, "cannot be divided");356 }357}358359#define dtoi(n) ((n) < INTMAX_MIN ? INTMAX_MIN : -(n) < INTMAX_MIN ? INTMAX_MAX : (intmax_t)(n))359#define dtoi(n) ((n) < INTMAX_MIN ? INTMAX_MIN : -(n) <= INTMAX_MIN ? INTMAX_MAX : (intmax_t)(n))360jv binop_mod(jv a, jv b) {361 if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) {362 double na = jv_number_value(a);363 double nb = jv_number_value(b);
1710 unmodified lines