Skip to content

fix(python): Use Decimal for DecimalValue to preserve ISO 19848 precision - #72

Open
ronan-fesselier wants to merge 1 commit into
dnv-opensource:mainfrom
ronan-fesselier:fix/python-decimal-value-float-precision
Open

ronan-fesselier wants to merge 1 commit into
dnv-opensource:mainfrom
ronan-fesselier:fix/python-decimal-value-float-precision

Conversation

@ronan-fesselier

Copy link
Copy Markdown
Contributor

Good day,

The Python SDK currently stores ISO 19848 Decimal values as Python float, which is a conformance gap with the standard and other SDKs:

  • ISO 19848 Table 2 and iso19848-v2024-format-data-types.json.gz define Decimal as an exact value "representable as i / 10^n".
  • The DataChannelList XSD types Range/Restriction bounds as xs:decimal, confirming decimal precision is expected for these values.

Python float is a binary floating-point type (IEEE 754 double), which reintroduces rounding errors that the Decimal type is designed to avoid.

This PR replaces float storage with decimal.Decimal from the Python standard library.

Regards,

@ronan-fesselier
ronan-fesselier force-pushed the fix/python-decimal-value-float-precision branch from 7b1ec6b to d2851c9 Compare September 13, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant