BAN: Fix negative floating point value printing
This commit is contained in:
parent
d8bb0b53f8
commit
73c292c4e9
|
@ -204,10 +204,14 @@ namespace BAN::Formatter
|
||||||
template<typename F, typename T>
|
template<typename F, typename T>
|
||||||
inline void print_floating(F putc, T value, const ValueFormat& format)
|
inline void print_floating(F putc, T value, const ValueFormat& format)
|
||||||
{
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
putc('-');
|
||||||
|
return print_floating(putc, -value, format);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t int_part = (int64_t)value;
|
int64_t int_part = (int64_t)value;
|
||||||
T frac_part = value - (T)int_part;
|
T frac_part = value - (T)int_part;
|
||||||
if (frac_part < 0)
|
|
||||||
frac_part = -frac_part;
|
|
||||||
|
|
||||||
print_integer(putc, int_part, format);
|
print_integer(putc, int_part, format);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue