From 2182c3ffd5df76272fea83a5d517c247f094c16b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Mar 2013 00:18:16 +0100 Subject: m_option: pretty-print floats with 3 pre-decimal digits instead of 2 There were complaints that ${fps} was printed as e.g. "23.98" instead of "23.976". Since there's no way to format floats exactly _and_ in a user- friendly way, just change the default precision for printing floats. --- core/m_option.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/m_option.c b/core/m_option.c index 6d011ee141..6e7b20a688 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -611,9 +611,9 @@ static char *print_double(const m_option_t *opt, const void *val) return talloc_asprintf(NULL, "%f", VAL(val)); } -static char *print_double_f2(const m_option_t *opt, const void *val) +static char *print_double_f3(const m_option_t *opt, const void *val) { - return talloc_asprintf(NULL, "%.2f", VAL(val)); + return talloc_asprintf(NULL, "%.3f", VAL(val)); } static void add_double(const m_option_t *opt, void *val, double add, bool wrap) @@ -639,7 +639,7 @@ const m_option_type_t m_option_type_double = { .size = sizeof(double), .parse = parse_double, .print = print_double, - .pretty_print = print_double_f2, + .pretty_print = print_double_f3, .copy = copy_opt, .clamp = clamp_double, }; @@ -670,9 +670,9 @@ static char *print_float(const m_option_t *opt, const void *val) return talloc_asprintf(NULL, "%f", VAL(val)); } -static char *print_float_f2(const m_option_t *opt, const void *val) +static char *print_float_f3(const m_option_t *opt, const void *val) { - return talloc_asprintf(NULL, "%.2f", VAL(val)); + return talloc_asprintf(NULL, "%.3f", VAL(val)); } static void add_float(const m_option_t *opt, void *val, double add, bool wrap) @@ -688,7 +688,7 @@ const m_option_type_t m_option_type_float = { .size = sizeof(float), .parse = parse_float, .print = print_float, - .pretty_print = print_float_f2, + .pretty_print = print_float_f3, .copy = copy_opt, .add = add_float, .clamp = clamp_float, -- cgit v1.2.3