RE: https://social.tchncs.de/@partim/116096802757484741

We need to pick a behaviour for Roto! Help us out with your opinions!

cc @nlnetlabs

#roto #rust #rustlang

@terts @nlnetlabs neither. Negative number division&remainder are unintuitive enough to just warrant a properly named method.
Rust Playground

A browser interface to the Rust compiler to experiment with the language

Rust Playground

A browser interface to the Rust compiler to experiment with the language

@terts @nlnetlabs the Python way is the canonical one. So I'd use that in the absence of a strong use case for the C way. (at least for modulo, don't really have an opinion on //)
@terts @nlnetlabs The C version is what the hardware does (IIRC), the Python one is better for most applications. You don't have to handle negative results when computing modulo, and there is no discontinuity at zero for example for DSP stuff.
@terts @nlnetlabs the Python version feels more wrong to me, especially the division. The result is much, much closer to 0, than to -1. I don't have opinions on the remainder, though.