Visitar URL original
fix: format DS numbers to 16 characters instead of cutting off the exponent by zzoraemon043 · Pull Request #610 · dcmjs-org/dcmjs · GitHub
Skip to content

fix: format DS numbers to 16 characters instead of cutting off the exponent - #610

Merged
pieper merged 1 commit into
dcmjs-org:masterfrom
zzoraemon043:fix/ds-number-formatting
Oct 19, 2026
Merged

pieper merged 1 commit into
dcmjs-org:masterfrom
zzoraemon043:fix/ds-number-formatting

Conversation

@zzoraemon043

Copy link
Copy Markdown

Fixes #531

denaturalizeDataset turned numbers into String(n) and then cut DS values to 16 characters, so 3.5163338899999997e-10 became 3.51633388999999 (the exponent was dropped). DS numbers are now formatted with DecimalString.convertToString first, the same formatting writeBytes already uses, which switches to exponential notation to stay within 16 characters. String values are left as they are.

Added a denaturalizeDataset test with the ImageOrientationPatient value 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.js passes, prettier and eslint are clean on the changed files.

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dcmjs2 ready!

Name Link
🔨 Latest commit d1bf3e5
🔍 Latest deploy log https://app.netlify.com/projects/dcmjs2/deploys/6ad5b5e252f7765a211a82f7
😎 Deploy Preview https://deploy-preview-610--dcmjs2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pieper
pieper merged commit aee06e4 into dcmjs-org:master Oct 19, 2026
16 checks passed
@pieper

pieper commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fix 👍

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.

Writing a DS number whose String() is longer than 16 characters cuts off the exponent (3.5e-10 is written as 3.516…)

2 participants