diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-10-17 02:53:11 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-10-18 11:34:52 +0200 |
commit | 02d009bc5c2dca3326c1a2551093c4bc3a67a6f7 (patch) | |
tree | 258bd94dd2cdad1dff28bf601b0b518d5e2776fc /options/m_option.c | |
parent | 11bbb49bdfcb43101bf00e6ffdcc097b751f78bb (diff) | |
download | mpv-02d009bc5c2dca3326c1a2551093c4bc3a67a6f7.tar.bz2 mpv-02d009bc5c2dca3326c1a2551093c4bc3a67a6f7.tar.xz |
player/command: truncate anything < 1e-4 in pretty printer
To avoid switching to scientific notation. Apparently it is "jarring"
for some users.
This preserves status quo from before 9dddfc4f where pretty printer were
truncated to 3 decimal places.
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/options/m_option.c b/options/m_option.c index 7d3222b1d3..458d38bafc 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -1028,7 +1028,12 @@ static char *print_double_7g(const m_option_t *opt, const void *val) double f = VAL(val); if (isnan(f)) return print_double(opt, val); - return talloc_asprintf(NULL, "%.7g", f); + // Truncate anything < 1e-4 to avoid switching to scientific notation + if (fabs(f) < 1e-4) { + return talloc_strdup(NULL, "0"); + } else { + return talloc_asprintf(NULL, "%.7g", f); + } } static void add_double(const m_option_t *opt, void *val, double add, bool wrap) |