0

So I have this formula :

abs = (MaxX-(MaxX*((xC2-abs)/(xC2-MaxX))))

The different values are respectively :

abs = 669

MaxX = 667

xC2 = 705

The program is always returning the value MaxX, and I can't seem to understand why. Note : I do a System.out.println(abs) just after the calculation.

Charly
  • 11
  • 2
  • 5
    Does this answer your question? [Int division: Why is the result of 1/3 == 0?](https://stackoverflow.com/questions/4685450/int-division-why-is-the-result-of-1-3-0) – OH GOD SPIDERS Jan 14 '22 at 13:24
  • Inserting your mentioned valus you get `(667-(667*((705-669)/(705-667))))` calculating the 2 parts of the division you get `(667-(667*(36/38)))` - `36/38` will result in `0`, see the duplicate. – OH GOD SPIDERS Jan 14 '22 at 13:26
  • Yes, I thought that even if it's an int, it wouldn't round down the numbers. Thanks a lot ! – Charly Jan 14 '22 at 13:27

0 Answers0