Skip to content

[FEATURE]: Add tolerance for values to datasets comparison #537

@mwojtyczka

Description

@mwojtyczka

Is there an existing issue for this?

  • I have searched the existing issues

Problem statement

Configurable tolerance would be useful so that decimal values are not always compared exactly, but can optionally be compared using tolerance. For example the following values may be considered equal: 2.001 i 2.0099.

Proposed Solution

Introduce tolerance to compare_datasets check.

a. Absolute tolerance
Values are considered equal if the absolute difference is less than or equal to the tolerance.
Example: abs(a - b) <= tolerance

With tolerance=0.01:
2.001 and 2.0099 → equal (diff = 0.0089)
2.001 and 2.02 → not equal (diff = 0.019)

b. Relative tolerance (percentage-based)
Useful if numbers vary in scale.
Example: abs(a - b) <= tolerance * max(abs(a), abs(b))
With tolerance=0.01 (1%):
100 vs 101 → equal (diff = 1, tolerance = 1)
2.001 vs 2.0099 → equal

We could introduce 2 params:
abs_tolerance (default 0.0)
rel_tolerance (default 0.0)

Additional Context

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions