From 3992921b51e3dd9a37e9d644f20bb8500c9042c5 Mon Sep 17 00:00:00 2001 From: wp Date: Mon, 20 May 2019 21:03:24 +0000 Subject: [PATCH] TAChart: Optimized floating point compare routine for sorting. Issue #35356, patch by Marcin Wiazowski git-svn-id: trunk@61252 - --- components/tachart/tacustomsource.pas | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/tachart/tacustomsource.pas b/components/tachart/tacustomsource.pas index 7461935ea4..a1e86fd093 100644 --- a/components/tachart/tacustomsource.pas +++ b/components/tachart/tacustomsource.pas @@ -1613,11 +1613,13 @@ end; function CompareFloat(const x1, x2: Double): Integer; begin - if IsNaN(x1) and IsNaN(x2) then - Result := 0 - else if IsNaN(x1) then - Result := +1 - else if IsNaN(x2) then + if IsNaN(x1) then begin + if IsNaN(x2) then + Result := 0 + else + Result := +1; + end else + if IsNaN(x2) then Result := -1 else Result := CompareValue(x1, x2);