mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-21 03:02:18 +00:00
Fix bug in previous formatting code.
[SVN r75603]
This commit is contained in:
@@ -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, '-');
|
||||
|
||||
Reference in New Issue
Block a user