ftoa incorrect conversion of numeric_limits<double>::max

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
FKupsch
Posts: 2
Joined: Thu, 2012-08-23, 14:39

ftoa incorrect conversion of numeric_limits<double>::max

#1 Post by FKupsch »

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.

Marco Eichelberg
OFFIS DICOM 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

#2 Post by Marco Eichelberg »

Thanks for the report. I have logged this in the DCMTK issue tracker as issue 860.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest