QIICR / dcmqi

dcmqi (DICOM for Quantitative Imaging) is a free, open source C++ library for conversion between imaging research formats and the standard DICOM representation for image analysis results
https://qiicr.gitbook.io/dcmqi-guide/
BSD 3-Clause "New" or "Revised" License
232 stars 62 forks source link

BUG: increase precision #415

Closed fedorov closed 3 years ago

fedorov commented 3 years ago

resolves #414

kislinsk commented 3 years ago

Here's my shot: http://cpp.sh/72ipr

To squeeze every little possible bit of precision out of it, you could print both scientific and fixed notation to strings and compare their lengths. If the scientific notation fits, use it. Fixed notation otherwise. The numeric_limits::max_digits10 ensures that both notations represent the maximum possible precision.

kislinsk commented 3 years ago

Nevermind, I just noticed that DCMQI only used float so it makes things easier in the context of 16 characters. The standard library provides useful constants for serializing floating point numbers with maximum precision and for float (with all the extras) it always fits even into less than 16 characters. I will create a pull request for review.

fedorov commented 3 years ago

replaced by #416