0

In JS for example, is n + 0.5 - 0.5 always going to equal n, for any integer n? If so is it because 0.5 is a power of 2 and so can be represented exactly?

user6118986
  • 341
  • 2
  • 15
  • Given you already know that some things cannot be represented exactly, how do you define "any integer n"? – Bergi May 21 '23 at 22:30
  • 1
    For any integer n until it isn’t, yeah, which is `(Number.MAX_SAFE_INTEGER + 1) / 2`. – Ry- May 21 '23 at 22:36

0 Answers0