From 605b8ccb3542e52c4273ac70d99f8a3ac66ebaee Mon Sep 17 00:00:00 2001 From: ArturTomczak Date: Mon, 10 Jun 2024 14:49:51 +0200 Subject: [PATCH] no tolerance in ranges Documenting the group decision, that there should be no tolerance for ranges #311, #315 --- ...point_range_greater_than_zero_exclusive.ifc | 2 +- ...point_range_greater_than_zero_inclusive.ifc | 2 +- ...g_point_range_lower_than_zero_exclusive.ifc | 2 +- ...g_point_range_lower_than_zero_inclusive.ifc | 2 +- ...point_range_greater_than_zero_exclusive.ifc | 2 +- ...point_range_greater_than_zero_inclusive.ifc | 2 +- ...g_point_range_lower_than_zero_exclusive.ifc | 2 +- ...g_point_range_lower_than_zero_inclusive.ifc | 2 +- Documentation/tolerance.md | 18 +++++++++++------- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc index 7e2bfc3..729738c 100644 --- a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc +++ b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.0000009),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.000000),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc index 23b3cdf..e5482ac 100644 --- a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc +++ b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.0000011),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.0000001),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc index a8cec81..729738c 100644 --- a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc +++ b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.0000009),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.000000),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc index 069e37c..b0d3573 100644 --- a/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc +++ b/Documentation/testcases/tolerance/fail-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.0000011),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.00000001),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc index 069e37c..806b292 100644 --- a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc +++ b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_exclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.0000011),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.0000001),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc index 420a4af..729738c 100644 --- a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc +++ b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_greater_than_zero_inclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.000001),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.000000),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc index 23b3cdf..e5482ac 100644 --- a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc +++ b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_exclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.0000011),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(-0.0000001),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc index 2f61cd9..729738c 100644 --- a/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc +++ b/Documentation/testcases/tolerance/pass-comparison_tolerance_for_floating_point_range_lower_than_zero_inclusive.ifc @@ -14,6 +14,6 @@ DATA; #7=IFCWALL('2nJrDaLQfJ1QPhdJR0o97J',$,$,$,$,$,$,$,$); #8=IFCPROPERTYSET('16MocU_IDOF8_x3Iqllz0d',$,'Foo_Bar',$,(#10)); #9=IFCRELDEFINESBYPROPERTIES('1xdwj8qGXK4hzoNbvMdXJW',$,$,$,(#7),#8); -#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.000001),$); +#10=IFCPROPERTYSINGLEVALUE('Foo',$,IFCREAL(0.000000),$); ENDSEC; END-ISO-10303-21; diff --git a/Documentation/tolerance.md b/Documentation/tolerance.md index 39eb4ee..7661206 100644 --- a/Documentation/tolerance.md +++ b/Documentation/tolerance.md @@ -46,16 +46,20 @@ The table below demonstrates characteristic ranges of values within the toleranc Note: the tolerance value is not configurable, as it is specific only for rounding errors, not for construction-related tolerances, for which users need to provide an explicit range. -## Range tolerance +## Ranges -Adding tolerance to range checks would open up all kinds of strange edge cases like 41.999958 being both in the range 42-50 inclusive, but also < 42 exclusive. For that reason, **exclusive ranges should be shrunk, while inclusive ranges should be stretched**. +**The tolerance does not apply to ranges**, as it would open up all kinds of strange edge cases (for example: 41.999958 being both in the range 42-50 inclusive, but also < 42 exclusive). The values used in ranges (minExclusive/minInclusive/maxExclusive/maxInclusive) should therfore be compared explicitly. For example: -For example: -- `x > 0 ⇒ x > 1.0e⁻⁶` -- `x >= 0 ⇒ x >= -1.0e⁻⁶` +| | >1.0 | >=1.0 | <1.0 | +|---:|-------------:|-------------:|---------:| +| 0.99999999 | fail | fail | pass | +| 1.00000000 | fail | pass | fail | +| 1.00000001 | pass | pass | fail | -If a numeric range constraint's spread is lower than the agreed limit, the Audit-tool should raise a warning. +This approach allows for specifying a custom tolerance in cases where the general rule is not applicable. For example: +- `(v - 1e-10) <= x <= (v + 1e-10)` checks that `x` is equal `v` with the custom tolerance of 1e-10, which is much more precise than the default formula +- `v <= x <= v` checks that `x` is exactly equal `v` with no tolerance # -Note: the history of these agreements can be traced in the history of [issue 78](https://github.com/buildingSMART/IDS/issues/78), [issue 36](https://github.com/buildingSMART/IDS/issues/36), and in [the summary by @giuseppeverduciALMA](https://github.com/buildingSMART/IDS/blob/0d50fd8f2dbd5b388f6fafb67da255cc3ce2b4ca/Documentation/tolerance.md). \ No newline at end of file +Note: the history of these agreements can be traced in the [issue 78](https://github.com/buildingSMART/IDS/issues/78), [issue 36](https://github.com/buildingSMART/IDS/issues/36), and in [the summary by @giuseppeverduciALMA](https://github.com/buildingSMART/IDS/blob/0d50fd8f2dbd5b388f6fafb67da255cc3ce2b4ca/Documentation/tolerance.md). \ No newline at end of file