-1

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

ssnake
  • 1
  • I wonder if you can define "round" more clearly? – Macrophage Dec 30 '17 at 03:18
  • 2
    This has a chance of being true when $a\ge 1$, but try $x=1$, $a=0.01$... – hmakholm left over Monica Dec 30 '17 at 03:44
  • @ssnake Is this the definition of round that 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
  • This is a math site, so we think $x$ and $a$ are reals, not computer numbers. Your statement is clearly false for $x$ not an integer if round returns an integer as I suspect. Please specify what type of number $x$ and $a$ are, that you are using computer multiply, etc. -1 – Ross Millikan Dec 30 '17 at 03:53
  • thanks all, sorry for the missing detals – ssnake Dec 30 '17 at 05:56

1 Answers1

0

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.

Ross Millikan
  • 374,822