Fix bug in previous formatting code.

[SVN r75603]
This commit is contained in:
John Maddock
2011-11-22 10:07:24 +00:00
parent 40123e7170
commit b3048e4ad2

View File

@@ -1755,13 +1755,13 @@ std::string cpp_float<Digits10>::str(std::streamsize number_of_digits, std::ios_
str.append(1, 'e');
str.append(boost::lexical_cast<std::string>(my_exp));
}
if(showpoint || scientific)
if((showpoint || scientific) && (number_of_digits != (std::numeric_limits<std::size_t>::max)()))
{
std::streamsize chars = str.size() - 1;
BOOST_ASSERT(str.find('.') != std::string::npos); // there must be a decimal point!!
chars = number_of_digits - chars;
if(chars > 0)
str.append(chars, '0');
str.append(static_cast<std::string::size_type>(chars), '0');
}
if(isneg())
str.insert(0, 1, '-');