Had a question regarding numerical rounding that I hope can be answered. Is there anyway to prove the following:
For any non-zero constant a, prove that x - round(round(x * a) * (1/a)) == 0
I have been playing with the case in python with:
for x in range(0, 1000000):
y = round(x * (1.2))
z = round(y * (1/1.2))
if z != x:
print(x)
which never prints, which got me wondering if there is a possible proof for this. Thanks!
edit: to be clear, this is the python3 round method: https://docs.python.org/3/library/functions.html#round
and this would only be for positive and real x and a, both >= 1
roundthat you are using? "Return number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input ...". If so, you should include that into the question, since not everybody here is familiar with the python libraries. – dxiv Dec 30 '17 at 03:47