mirror of
https://github.com/boostorg/charconv.git
synced 2026-02-09 11:02:30 +00:00
Add precision argument
This commit is contained in:
@@ -413,7 +413,7 @@ static inline int generic_to_chars(const struct floating_decimal_128 v, char* re
|
||||
return index;
|
||||
}
|
||||
|
||||
static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, int) noexcept
|
||||
static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, int precision) noexcept
|
||||
{
|
||||
if (v.exponent == fd128_exceptional_exponent)
|
||||
{
|
||||
@@ -469,6 +469,12 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch
|
||||
current_len = -v.exponent + 2;
|
||||
}
|
||||
|
||||
if (current_len < precision)
|
||||
{
|
||||
memset(result + current_len, '0', precision - current_len);
|
||||
current_len = precision;
|
||||
}
|
||||
|
||||
return current_len;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user