From 076b913c7f876ba0489b9751043eeb61aa34680f Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Thu, 17 Aug 2023 04:21:05 +0800 Subject: Compare all percentage fields with compareRealNumbers() The SPACESHIP_NUMBER() macro does not work well with floating point values that are possible to be NaNs. Change the compare logic of all percentage fields of Process entries to use compareRealNumbers(). Signed-off-by: Kang-Che Sung --- Process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Process.c') diff --git a/Process.c b/Process.c index 7e2d11af..7244ad9f 100644 --- a/Process.c +++ b/Process.c @@ -1182,7 +1182,7 @@ int Process_compareByKey_Base(const Process* p1, const Process* p2, ProcessField switch (key) { case PERCENT_CPU: case PERCENT_NORM_CPU: - return SPACESHIP_NUMBER(p1->percent_cpu, p2->percent_cpu); + return compareRealNumbers(p1->percent_cpu, p2->percent_cpu); case PERCENT_MEM: return SPACESHIP_NUMBER(p1->m_resident, p2->m_resident); case COMM: -- cgit v1.2.3