You've already forked lazarus-ccr
LazStats: Fix FreqUnit crashing due to improper array dimensions.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7716 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1441,8 +1441,20 @@
|
||||
<OtherUnitFiles Value="forms;forms\analysis;forms\analysis\cross-classification;forms\analysis\financial;forms\analysis\descriptive;forms\analysis\one_sample_tests;forms\analysis\comparisons;forms\analysis\correlation;forms\analysis\matrix_manipulation;forms\analysis\measurement_programs;forms\analysis\measurement_programs\item_banking;forms\analysis\multiple_regression;forms\analysis\multivariate;forms\analysis\nonparametric;forms\analysis\statistical_process_control;forms\help;forms\options;forms\misc;forms\simulations;forms\tools;forms\variables;units;frames"/>
|
||||
<UnitOutputDirectory Value="..\ppu\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<VerifyObjMethodCallValidity Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="2"/>
|
||||
</Optimizations>
|
||||
@ -1452,11 +1464,6 @@
|
||||
<DebugInfoType Value="dsDwarf2"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
|
@ -6,7 +6,7 @@ unit FreqUnit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uses lazlogger,
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, LCLVersion,
|
||||
StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin,
|
||||
Globals, MainUnit, DataProcs,
|
||||
@ -108,7 +108,9 @@ var
|
||||
m: Double;
|
||||
e: Integer;
|
||||
begin
|
||||
intervalSize := round((AMax - AMin) / NoIntervalsEdit.Value);
|
||||
// intervalSize := round((AMax - AMin) / NoIntervalsEdit.Value);
|
||||
intervalSize := (AMax - AMin) / NoIntervalsEdit.Value;
|
||||
if intervalSize = 0 then intervalSize := 1;
|
||||
MantisseAndExponent(intervalSize, m, e);
|
||||
m := round(m);
|
||||
AIntervalSize := m * IntPower(10, e);
|
||||
@ -164,13 +166,6 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
SetLength(freq, NoCases);
|
||||
SetLength(pcnt, NoCases);
|
||||
SetLength(cumpcnt, NoCases);
|
||||
SetLength(pcntilerank, NoCases);
|
||||
SetLength(cumfreq, NoCases);
|
||||
SetLength(XValue, NoCases);
|
||||
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
lReport.Add('FREQUENCY ANALYSIS BY BILL MILLER');
|
||||
@ -208,8 +203,12 @@ begin
|
||||
CalcIntervals(min, max, incrSize, nInts);
|
||||
|
||||
SetLength(freq, nInts);
|
||||
SetLength(cumFreq, nInts);
|
||||
SetLength(XValue, nInts);
|
||||
SetLength(XLabels, nInts);
|
||||
SetLength(pcnt, nInts);
|
||||
SetLength(cumPcnt, nInts);
|
||||
Setlength(pcntileRank, nInts);
|
||||
|
||||
// Get frequency of cases in each interval
|
||||
nCases := 0;
|
||||
@ -239,7 +238,7 @@ begin
|
||||
pcnt[0] := freq[0] / nCases;
|
||||
cumPcnt[0] := cumFreq[0] / nCases;
|
||||
pcntileRank[0] := (freq[0] * 0.5) / nCases;
|
||||
for k := 1 to nInts - 1do
|
||||
for k := 1 to nInts - 1 do
|
||||
begin
|
||||
cumfreq[k] := cumfreq[k-1] + freq[k];
|
||||
pcnt[k] := freq[k] / nCases;
|
||||
|
Reference in New Issue
Block a user