summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-26 00:18:16 +0100
committerwm4 <wm4@nowhere>2013-03-26 01:29:54 +0100
commit2182c3ffd5df76272fea83a5d517c247f094c16b (patch)
treee7f3d1219ecef710cf2c21cc7e27104b0a49f6ad /core
parentd48c85566989b3545641b48cca6a20b46e075897 (diff)
downloadmpv-2182c3ffd5df76272fea83a5d517c247f094c16b.tar.bz2
mpv-2182c3ffd5df76272fea83a5d517c247f094c16b.tar.xz
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.
Diffstat (limited to 'core')
-rw-r--r--core/m_option.c12
1 files 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,