Modulo Operation/Examples/0.11 mod -0.1
Jump to navigation
Jump to search
Theorem
- $0 \cdotp 11 \bmod -0 \cdotp 1 = -0 \cdotp 09$
where $\bmod$ denotes the modulo operation.
Proof
By definition of modulo operation:
- $x \bmod y := x - y \floor {\dfrac x y}$
for $y \ne 0$.
We have:
\(\ds \dfrac {0 \cdotp 11} {-0 \cdotp 1}\) | \(=\) | \(\ds \dfrac {1 \cdotp 1} {-1}\) | ||||||||||||
\(\ds \) | \(=\) | \(\ds -1 \cdotp 1\) |
and so:
- $\floor {\dfrac {0 \cdotp 11} {-0 \cdotp 1} } = -2$
Thus:
\(\ds 0 \cdotp 11 \bmod -0 \cdotp 1\) | \(=\) | \(\ds 0 \cdotp 11 - \paren {-0 \cdotp 1} \times \floor {\dfrac {0 \cdotp 11} {-0 \cdotp 1} }\) | ||||||||||||
\(\ds \) | \(=\) | \(\ds 0 \cdotp 11 - \paren {-0 \cdotp 1} \times \paren {-2}\) | ||||||||||||
\(\ds \) | \(=\) | \(\ds 0 \cdotp 11 - 0 \cdotp 2\) | ||||||||||||
\(\ds \) | \(=\) | \(\ds -0 \cdotp 09\) |
$\blacksquare$
Sources
- 1997: Donald E. Knuth: The Art of Computer Programming: Volume 1: Fundamental Algorithms (3rd ed.) ... (previous) ... (next): $\S 1.2.4$: Integer Functions and Elementary Number Theory: Exercise $10$