While writing some unit tests, I've observed a potential issue with ofstd::ftoa(). When reading a value from a tag of VR: FD to OFstring, the value represented by the string is incorrect, if the value of the tag is the upper boundary of double (std::numeric_limits<double>::max). While the value in the tag is 1.7976931348623157e+308, the value of the string is 1.7976931348623167e+308. Now the string cannot be converted to double (e.g. using std::stod), because it exceeds the representable maximum of double.
The conversion seems to be correct, when using sprintf instead of ftoa.
ftoa incorrect conversion of numeric_limits<double>::max
Moderator: Moderator Team
-
- OFFIS DICOM Team
- Posts: 1444
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: ftoa incorrect conversion of numeric_limits<double>::max
Thanks for the report. I have logged this in the DCMTK issue tracker as issue 860.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest