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
Add support for the xsd:decimal XML Schema datatype in the vocabulary type system, so properties like hasNumericalValue can use a semantically correct, precision-safe type.
Context: PR #579 review discussion.
Problem
The vocabulary type system currently has no support for xsd:decimal. In PR #579 (FEP-0837 Federated Marketplace vocabulary), the Measure type's hasNumericalValue property had to use xsd:string as a stopgap because xsd:float introduces IEEE 754 floating-point rounding errors (e.g., 0.1 + 0.2 !== 0.3), which are hardly acceptable in monetary and marketplace contexts.
Add xsd:decimal as a supported range type in the vocabulary type system. Once supported, properties like hasNumericalValue can be updated from xsd:string to xsd:decimal.
The key design decision is how to represent xsd:decimal values in TypeScript. This should be discussed before implementation.
Alternatives Considered
number: Simple, but subject to floating-point precision issues. Unsuitable for financial values.
Summary
Add support for the
xsd:decimalXML Schema datatype in the vocabulary type system, so properties likehasNumericalValuecan use a semantically correct, precision-safe type.Context: PR #579 review discussion.
Problem
The vocabulary type system currently has no support for
xsd:decimal. In PR #579 (FEP-0837 Federated Marketplace vocabulary), theMeasuretype'shasNumericalValueproperty had to usexsd:stringas a stopgap becausexsd:floatintroduces IEEE 754 floating-point rounding errors (e.g.,0.1 + 0.2 !== 0.3), which are hardly acceptable in monetary and marketplace contexts.Using
xsd:stringworks but loses type-level semantics and requires manual parsing and validation by consumers.More context at the following issues "Add Note about xsd:float and xsd:double Limitation"
Proposed Solution
Add
xsd:decimalas a supported range type in the vocabulary type system. Once supported, properties like hasNumericalValue can be updated from xsd:string to xsd:decimal.The key design decision is how to represent xsd:decimal values in TypeScript. This should be discussed before implementation.
Alternatives Considered
Scope / Dependencies