aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/printf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-16 14:04:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-16 14:04:28 +0100
commitee201b7a8c5a1116f3aae19de68520d9fc7391d3 (patch)
treef16fc38e7856dafd354439d09daa01b7f549be94 /src/libutil/printf.c
parent277d0a32c3327a92fde4a9c8de15e51d2d4c6e89 (diff)
downloadrspamd-ee201b7a8c5a1116f3aae19de68520d9fc7391d3.tar.gz
rspamd-ee201b7a8c5a1116f3aae19de68520d9fc7391d3.zip
[Fix] Fix floating point printing
Diffstat (limited to 'src/libutil/printf.c')
-rw-r--r--src/libutil/printf.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/libutil/printf.c b/src/libutil/printf.c
index 9dc14441c..84dd5d272 100644
--- a/src/libutil/printf.c
+++ b/src/libutil/printf.c
@@ -947,9 +947,8 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
case 'f':
- case 'g':
f = (gdouble) va_arg (args, double);
- slen = fpconv_dtoa (f, dtoabuf);
+ slen = fpconv_dtoa (f, dtoabuf, false);
if (frac_width != 0) {
const gchar *dot_pos = memchr (dtoabuf, '.', slen);
@@ -980,10 +979,16 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
continue;
+ case 'g':
+ f = (gdouble) va_arg (args, double);
+ slen = fpconv_dtoa (f, dtoabuf, true);
+ RSPAMD_PRINTF_APPEND (dtoabuf, slen);
+
+ continue;
+
case 'F':
- case 'G':
f = (gdouble) va_arg (args, long double);
- slen = fpconv_dtoa (f, dtoabuf);
+ slen = fpconv_dtoa (f, dtoabuf, false);
if (frac_width != 0) {
const gchar *dot_pos = memchr (dtoabuf, '.', slen);
@@ -1014,6 +1019,13 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
continue;
+ case 'G':
+ f = (gdouble) va_arg (args, long double);
+ slen = fpconv_dtoa (f, dtoabuf, true);
+ RSPAMD_PRINTF_APPEND (dtoabuf, slen);
+
+ continue;
+
case 'p':
ui64 = (uintptr_t) va_arg (args, void *);
hex = 2;