How do you calculate the modulus of a fractional number, a negative number or a positive number?
Could you explain any example with the whole process?
|
How do you calculate the modulus of a fractional number, a negative number or a positive number? Could you explain any example with the whole process? |
|||||||||
|
|
One way to extend the remainder, or modulo, function $b\mod a$ to a fractional number $b$ is to subtract from $b$ the greatest integer $a\times q$ that is less than or equal to $b$, where $q$ must be an integer. The operation defined above could be written as $b - a\times \lfloor b/a \rfloor$, where $\lfloor x\rfloor$ represents the greatest integer less than or equal to $x$. Example. If $b = 5/2$ and $a = 2$, then by the above definition, $b\mod a = 5/2 - 2 \cdot \lfloor (5/2)/2\rfloor = 5/2 - 2 \cdot \lfloor 5/4\rfloor = 5/2 - 2 = 1/2$. |
||||
|
|