Name of this modulo operation

71 Views Asked by At

I am looking for an operator on $\mathbb{Q}$ that is similar to the modulo operator, but gives me the smallest representative of the class $[0,p]$ instead of $[0,p)$.

Let's call it $\mod'$.

For example:

$\frac{1}{2} \mod ' \frac{1}{2} = \frac{1}{2}$ and

$d \mod ' \frac{1}{2} = d - \frac{1}{2}, d \in \mathbb{Q}, 1 > d > \frac{1}{2}$.

1

There are 1 best solutions below

2
On

The modulo operation does not "cut" anything or any numbers, it just says you the smallest representative of the class. if you want to really cut all numbers greater 1/2 just declare a function f(x)=x for x<=1/2 , f(x)=0 for x>1/2.