I'm trying to read data from multiple files, check for differences, and then see if the differences are within a given tolerance. At the moment, I'm loading the data from the file into an object, one field of which I am casting as a float, like so:
self.data = float(data)
Now, if there are similarities between files, I want to see if the data is the same, or if not the same, at least within a given tolerance of one another. So if there's a match, I take the absolute value of the differences between the two.
diff = abs(datum1.getData() - datum2.getData())
So far so good, and when I print the individual parts out the math seems good so far; however, when I then make the comparison against the user provided tolerance, the tolerance is always computed as the larger number. I can provide a tolerance of 0.0, and the program will print:
0.0 > 2.68188167066e-05
Any ideas on what's happening here? Is it just a loss of precision as my numbers are so small? Suggestions? I can provide more of / all of the code if you like, but it didn't seem necessary; simple printlining reveals that the data is true.