Repository navigation
fix: format DS numbers to 16 characters instead of cutting off the exponent - #610
Merged
Merged
Conversation
✅ Deploy Preview for dcmjs2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Collaborator
|
Thanks for the fix 👍 |
This was referenced Oct 28, 2026
This was referenced Oct 30, 2026
This was referenced Nov 24, 2026
wayfarer3130
added a commit
that referenced
this pull request
Nov 25, 2026
…e exponent (#654) * fix(VR): format DS numbers to 16 characters instead of cutting off the exponent 1.0 port of #610 (commit aee06e4), with the round trip test of #624. denaturalizeDataset in packages/core now formats each number of a DS array with DecimalString.convertToString before denaturalizeValue, so 3.5163338899999997e-10 is written as 3.5163338900e-10 and not cut to 3.51633388999999. Both tests go in test/issues/issue531-ds-exponent.test.js (#610 fixes #531). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(VR): format a single DS number and a Number object to 16 characters Review items S1 and N1 of the 1.0 port of #610. The 1.x port now also formats the scalar case: a VM 1 DS attribute, for example SliceThickness or SliceLocation, is a single number in a 1.x naturalized dataset, and it went through String() and was cut to 16 characters. A Number object (new Number(...)) is formatted the same way. One formatDs function serves the scalar and the list form. master (0.x) has the same scalar gap after #610. The JSDoc of denaturalizeDataset cites PS3.5 Table 6.2-1. The bundle-size ceilings move to 1.081 and 1.063 for this change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: record the DS formatting in NAT-U-RT-8 and the release notes Maintainer decision Q2 of the review of the 1.0 port of #610: NAT-U-RT-8 in docs/specs/naturalized-dataset.md, with the PS3.5 Section 6.2, Table 6.2-1 reference and the test file, and one bullet in beta-1-release-notes.md. No NAT-I rule covers the DS write, so no NAT-I rule changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(bundle-size): raise the dcmjs.es.js ceiling to 1.064 after #652 The rebase onto 1.0-beta adds the declared length clamp of #652 to the DS formatting of this branch: dcmjs.es.js is x1.0632. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #531
denaturalizeDatasetturned numbers intoString(n)and then cut DS values to 16 characters, so3.5163338899999997e-10became3.51633388999999(the exponent was dropped). DS numbers are now formatted withDecimalString.convertToStringfirst, the same formattingwriteBytesalready uses, which switches to exponential notation to stay within 16 characters. String values are left as they are.Added a
denaturalizeDatasettest with theImageOrientationPatientvalue from the issue; it fails before the change.jest test/DicomMetaDictionary.test.js test/data-encoding.test.js test/data-options.test.js test/normalizers.test.jspasses, prettier and eslint are clean on the changed files.