[Solved] Difference between 2 floats [closed]


The result is correct. Try to visualize it:

enter image description here

Distance between -110 and 100 is the sum of distance between -110 and 0 (Mathf.Abs(-110 - 0) = 110) and distance between 100 and 0 (Mathf.Abs(100 - 0) = 100). That is: 110 + 100 = 210. Perhaps you have a different operation in mind? If you want distance between absolute values of arguments, then try:

Mathf.Abs(Mathf.Abs(X) - Mathf.Abs(Y))

which will yield 10 for -110 and 100.

2

solved Difference between 2 floats [closed]