Rounding of an integer multiplied by a decimal

35 Views Asked by At

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

1

There are 1 best solutions below

0
On

You can't prove it because it isn't true. round(something) is an integer, so if $x$ is not an integer the left side is not zero.