2 ms·
This depends on what the behavior is of the division operator. People should use floor division, then implementing modulo is easy. I don’t know what is availab
by jacobolus 8y ago
This depends on what the behavior is of the division operator. People should use floor division, then implementing modulo is easy.
I don’t know what is available as chip instructions, I could certainly believe hardware designers made the wrong choice.
- simonbyrne 8y agoI take the opinion that people should have the option to round division (and compute remainders) however they want: down, up, to zero, to nearest (with different options for breaking ties). https://github.com/JuliaLang/julia/issues/9283 https://github.com/JuliaLang/julia/issues/9283
- ScottBurson 8y agoCommon Lisp has all four division operators ('floor', 'ceiling', 'truncate' (equivalent to what most languages consider division), and 'round') [0], and both 'mod' and 'rem' [1]. [0] http://www.lispworks.com/documentation/lw50/CLHS/Body/f_floorc.htm http://www.lispworks.com/documentation/lw50/CLHS/Body/f_floo... [1] http://www.lispworks.com/documentation/lw50/CLHS/Body/f_mod_r.htm http://www.lispworks.com/documentation/lw50/CLHS/Body/f_mod_...