Files
lazarus-ccr/applications/lazstats/source_orig/tprobunit.pas
wp_xxyyzz eb017ea8b7 LazStats: Adding original source, part 8.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7887 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2020-11-16 11:23:17 +00:00

68 lines
1.3 KiB
ObjectPascal

unit TprobUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, functionslib;
type
{ TTprobForm }
TTprobForm = class(TForm)
CancelBtn: TButton;
tValueEdit: TEdit;
ComputeBtn: TButton;
DFEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ProbEdit: TEdit;
ResetBtn: TButton;
ReturnBtn: TButton;
procedure ComputeBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
TprobForm: TTprobForm;
implementation
{ TTprobForm }
procedure TTprobForm.ResetBtnClick(Sender: TObject);
begin
tValueEdit.Text := '';
DFEdit.Text := '';
ProbEdit.Text := '';
end;
procedure TTprobForm.ComputeBtnClick(Sender: TObject);
VAR
tvalue, dfvalue, prob : double;
outvalue : string;
begin
tvalue := StrToFloat(tValueEdit.Text);
dfvalue := StrToFloat(DFEdit.Text);
if tvalue >= 0.0 then prob := 0.5 * probt(tvalue,dfvalue);
if tvalue < 0.0 then prob := 1.0 - probt(tvalue,dfvalue) +
(0.5 * probt(tvalue,dfvalue)) ;
if tvalue = 0.0 then prob := 0.50;
outvalue := format('%6.4f',[prob]);
ProbEdit.Text := outvalue;
end;
initialization
{$I tprobunit.lrs}
end.