From a8994b9268fc3267a72cec9bf05a549f44b65c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 3 Jun 2022 19:43:28 +0200 Subject: [PATCH] tag: for now, always use 2 decimals for floats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the future, we’ll want to add a way to specify the number of decimals, as part of the formatter. --- tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag.c b/tag.c index 0428223..fc09bdc 100644 --- a/tag.c +++ b/tag.c @@ -583,7 +583,7 @@ tags_expand_template(const char *template, const struct tag_set *tags) char str[24]; if (tag->type(tag) == TAG_TYPE_FLOAT) - snprintf(str, sizeof(str), "%f", tag->as_float(tag) / (double)divider); + snprintf(str, sizeof(str), "%.2f", tag->as_float(tag) / (double)divider); else snprintf(str, sizeof(str), "%lu", tag->as_int(tag) / divider); sbuf_append(&formatted, str);