Welcome! Please see the About page for a little more info on how this works.
The workaround for negative numbers (https://dev.clojure.org/jira/browse/CLJS-417) results in annoying behavior for floats:
(mod 2.1 3) ; => 2.0999999999999996
Two possible solutions:
Comment made by: dnolen
Comment made by: zto
The patch renames cljs.core/mod to double-mod and redefines mod to invoke js-mod directly when both args have the same sign.
It includes test cases for the previously failing cases, but I've also tested more exhaustively against the Clojure impl: https://gist.github.com/aw7/a32bd69923c65bddc23fd63ee062833c
Great thanks, have you submitted your Clojure CA?
Yeah, 2h ago.
Comment made by: anmonteiro
Nit: shouldn't the double-mod function be marked as private then?
I guess there's no need for double-mod to exist as a separate function at all, I've added a patch where it's inlined into mod.
Comment made by: mfikes