]> granicus.if.org Git - procps-ng/commit
vmstat: precision issues in unitConvert()
authorQin Fandong <shell_way@foxmail.com>
Wed, 18 Jan 2023 06:02:53 +0000 (17:02 +1100)
committerCraig Small <csmall@dropbear.xyz>
Wed, 18 Jan 2023 06:02:53 +0000 (17:02 +1100)
commit0a5ccbdd4273f063344b70be15fb22f3e7c250a6
tree853185ed77adac664c6dc4bff8c3151ea3f09b16
parent68e2c0fc53c78217d5fb3bfbb6f73a6e5d0e39bd
vmstat: precision issues in unitConvert()

Fix conversion errors due to precision issues in function unitConvert

For example: unitConvert(98720620) will return 98720624, not 98720620.

Because we do (unsigned long)(float)98720620 in function unitConvert
and this is wrong! We should do (unsigned long)(double)98720620 here.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
References:
 procps-ng/procps!75
NEWS
src/vmstat.c