quot and rem are inefficient
The implementation of the quot and rem functions are needlessly complicated. Currently they are:
However all numbers in js are doubles already, so all this is unnecessary:
Notice that "rem" is simply js-mod, and I'm not sure why no one noticed this before. I keep js-mod for now since a lot of code uses it, and if cljs ever grows a number tower the distinction may be important.
Patch attached, which also:
Creates a macro version of quot and rem.
Updates documentation for quot, rem, js-mod and mod for clarity.
Implement fix (private function to round to zero) with ES6 Math.trunc() if available.
Existing quot and rem tests pass, although there could be some better tests of edge cases (negative decimal num or div, NaN and +-Infinity args).
CLJS-1164-1.patch no longer applies to master
Since this is a low-level numerics update, also ran the unit tests through ChackraCore (successfully).
I also manually ran some of the unit tests in bootstrapped ClojureScript built with the patch.
Patch cleaned up
Patch now applies. I only tested with Nashorn: