mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 15:39:32 +02:00
TAChart: Fix various cases of SIGFPE in RoundToImage method
git-svn-id: trunk@34853 -
This commit is contained in:
parent
0f055aa049
commit
366a247eab
@ -282,18 +282,19 @@ procedure TIntervalChartSource.RoundToImage(
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i, x: Integer;
|
i: Integer;
|
||||||
v, p, rv: Double;
|
v, p, rv: Double;
|
||||||
|
x: Int64;
|
||||||
begin
|
begin
|
||||||
if AParams.FIntervals.Tolerance = 0 then exit;
|
if AParams.FIntervals.Tolerance = 0 then exit;
|
||||||
for i := 0 to High(AValues) do begin
|
for i := 0 to High(AValues) do begin
|
||||||
v := AValues[i].FValue;
|
v := AValues[i].FValue;
|
||||||
if v = 0 then continue;
|
if (v = 0) or IsInfinite(v) or IsNan(v) then continue;
|
||||||
x := A2I(v);
|
x := A2I(v);
|
||||||
p := Power(10, Floor(Log10(Abs(v)) - Log10(High(Int64)) + 1));
|
p := Power(10, Floor(Log10(Abs(v)) - Log10(High(Int64)) + 1));
|
||||||
while true do begin
|
while v <> 0 do begin
|
||||||
rv := Round(v / p) * p;
|
rv := Round(v / p) * p;
|
||||||
if Cardinal(Abs(A2I(rv) - x)) >= AParams.FIntervals.Tolerance then break;
|
if Abs(A2I(rv) - x) >= AParams.FIntervals.Tolerance then break;
|
||||||
v := rv;
|
v := rv;
|
||||||
p *= 10;
|
p *= 10;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user