mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-09 13:30:17 +01:00
os: Round fraction in pnprintf %f format
Truncating the fraction part leads to a test failure where -1203.30 is printed as -1203.29. Round this to the nearest value instead by adding 0.5 before converting to an integer Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
509b3c3dc8
commit
b173eb2ae3
1 changed files with 1 additions and 1 deletions
|
|
@ -1999,7 +1999,7 @@ FormatDouble(double dbl, char *string)
|
|||
int slen = 0;
|
||||
uint64_t frac;
|
||||
|
||||
frac = (dbl > 0 ? dbl : -dbl) * 100.0;
|
||||
frac = (dbl > 0 ? dbl : -dbl) * 100.0 + 0.5;
|
||||
frac %= 100;
|
||||
|
||||
/* write decimal part to string */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue