Closed fedorov closed 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.
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.
replaced by #416
resolves #414