@craigmaloney@octodon.social @noelle mod is NOT the same as remainder and this is the difference :). the problem (from this person's point of view, anyway, likely) is that most programming languages use % to mean remainder, and python (apparently) uses it to mean modulus.

Follow

@craigmaloney@octodon.social @noelle if you're curious about this decision, it comes from how python rounds //

many languages drop the fractional part, so -6 // 8 is 0. you then need a -6 to get back to your original value.

8*0 + (-6) == -6

python always rounds down, so -6 // 8 is -1. so you need a 2:

8*(-1) + 2 == -6

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.