News for hackers. Stuff that matters.
Re:Why Python's Integer Division Floors (2010) by pwdisswordfishc on Wednesday February 28, 2024 @11:28AM (#39540166)
Exactly. Modulo is not an operator, but a term for an equivalence class of differing by a multiple of a number fixed in advance.
Re:Why Python's Integer Division Floors (2010) by marko_oktabyr on Wednesday February 28, 2024 @12:01PM (#39540731)
As sibling comments have mentioned, "operator" here is being used in the programming language sense of the word, not the mathematical sense. Using the name "mod" [as in mod(a,n)] or "modulo" for the mapping that takes integers to a particular representative of its equivalence class in Z/nZ ("integers modulo n") doesn't seem like an unreasonable choice to me.
Re:Why Python's Integer Division Floors (2010) by Karellen on Wednesday February 28, 2024 @11:51AM (#39540586)
> Modulo is not an operator,

"operator" is being used as a term of art in programming language design, to describe a symbol used to indicate that an operation should be performed on one or more operands.

https://en.wikipedia.org/wiki/Operator_(computer_programming...

So the "%" symbol is an operator in C and Python, and it is standard usage to describe the operator that performs a mathematical function "X" as the "X operator".

Re:Why Python's Integer Division Floors (2010) by mathgradthrow on Wednesday February 28, 2024 @11:45AM (#39540474)
That's an operator. A map to the quotient.
Re:Why Python's Integer Division Floors (2010) by kazinator on Wednesday February 28, 2024 @01:04PM (#39541560)
(mod N) is an operator which indicates that the arithmetic in the preceding formula or equation is understood as taking place in a modulo N congruence.

A triple equal sign is usually used for modular equations. That triple equal sign, together with the (mod N) out to the right, constitute an operator.

-1 ≡ 9 (mod 10)

Since it is written as part of the syntax of a formula or equation, and modifies its semantics, it is an operator. Just like d/dx, sigma notation and whatever not.