0

I am trying to match values between arrays.

I realize some operations are calculating these as False when if should be true. One of the values it seems contains more decimal values.

        Debug.Print x / 100
        Debug.Print y
        Debug.Print (x / 100) - y

This results in:

0.9248

0.9248

1.11022302462516E-16

I've tried using round & formatcurrency. While it will show the values as rounded, it still retains the scientific notation when calculating.

Does anyone have any suggestion on how i can get x = y to flag as 'true'?

Thanks.

Chris
  • 45
  • 1
  • 8
  • 2
    You might consider reading [Is floating-point math broken](https://stackoverflow.com/questions/588004/is-floating-point-math-broken) – BigBen Mar 13 '20 at 23:04
  • 1
    Thanks for link. I did not know what this problem was called to search for a solution. I ended up using abs() < 0.000001 as my tolerance. – Chris Mar 13 '20 at 23:10

1 Answers1

0

Link by BigBen, used abs function and check if less then a specific value.

Chris
  • 45
  • 1
  • 8