You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update PR 1544 review with empirical findings from both options
Option A (implicit cast): 1 line library change, 101 mechanical test
fixes, 0 new test failures across ~51,900 tests. Verified working.
Option B (double public): 608 files changed, 0 library build errors,
but 2,509 test failures (5%) due to precision loss from double storage.
Roundtrip conversions that were lossless with QuantityValue now lose
precision. This defeats a core value proposition of the PR.
Recommendation: Option A is clearly superior — simpler, preserves full
precision, and empirically verified.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Option B was scoped but not implemented due to the scale of changes required:
164
+
**Tests: 2,509 failures out of 51,899.** The failures are NOT test bugs — they reveal a fundamental trade-off:
165
+
-**1,215 `ToUnit_FromNonBaseUnit` failures**: Converting a quantity to another unit and back loses precision because `double` storage introduces floating-point rounding at each step. With `QuantityValue`, this roundtrip was lossless.
166
+
-**491 `ToUnit_FromIQuantity` failures**: Same root cause.
-**CodeGen templates**: ~15 locations in `QuantityGenerator.cs`, plus `NumberExtensionsGenerator.cs`, `NumberExtensionsCS14Generator.cs`, `QuantityRelationsParser.cs`
156
-
-**Data files**: `UnitRelations.json` type reference
157
-
-**Regeneration**: All 131 quantity files + number extensions + test base classes
158
-
-**Serialization layer rework**: Serializers currently read/write `QuantityValue` from `IQuantity.Value` — changing to `double` fundamentally changes the wire format
159
-
-**Estimated effort**: Multi-day, with significant risk of cascading issues in serialization
170
+
**Key finding**: Option B fundamentally degrades conversion precision. The exact rational conversion pipeline (`QuantityValue × rational_coefficient`) helps, but the `double` input/output introduces rounding that compounds across multi-step conversions. This defeats a core value proposition of the PR.
160
171
161
-
Given that Option A achieves the same consumer-facing goal with 1 line of library code changed, Option B is not recommended unless Option A proves unworkable in practice.
172
+
Given that Option A achieves the same consumer-facing goal with 1 line of library code, 0 new test failures, and preserves full precision, **Option B is not recommended.**
0 commit comments