seperman / deepdiff

DeepDiff: Deep Difference and search of any Python object/data. DeepHash: Hash of any object based on its contents. Delta: Use deltas to reconstruct objects by adding deltas together.
http://zepworks.com
Other
2k stars 219 forks source link

Feature: Add threshold for numerics #68

Open seperman opened 7 years ago

seperman commented 7 years ago

We already have ignore significant digits but what we need to add is a threshold for numerics so that it ignores the diff if it is within the threshold.

For example if threshold is 1% then the diff between 1000 and 1001 should be ignored.

seperman commented 7 years ago

This feature has turned out to be tricky to implement when ignore_order=True.

Option1: Have some sort of threshold that rounds up numbers the way we are already doing it with significant digits, except do it on the other side of the decimal point too.

Option 2: We can also add 2 other parameters when ignore_order=False to basically use Python3's math.isclose(). If we do that then we will have 2 parameters that work only when ignore_order=False.

We can add both of these options. What do you guys think? @Bernhard10 @victorhahncastell