mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 12:36:15 +02:00
TAChart: Fix parameters in TExpressionSeries.
git-svn-id: trunk@56351 -
This commit is contained in:
parent
1afbcdb13b
commit
bbbbc443fb
@ -396,3 +396,4 @@ msgstr "Fehler beim Umbenennen von Komponenten: %s"
|
|||||||
#: tachartstrconsts.tastoolseditortitle
|
#: tachartstrconsts.tastoolseditortitle
|
||||||
msgid "Edit tools"
|
msgid "Edit tools"
|
||||||
msgstr "Werkzeuge bearbeiten"
|
msgstr "Werkzeuge bearbeiten"
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ resourcestring
|
|||||||
rsBSPattern = 'pattern fill';
|
rsBSPattern = 'pattern fill';
|
||||||
|
|
||||||
rsErrInvalidResultType = 'Expression result type must be integer or float. Got "%s".';
|
rsErrInvalidResultType = 'Expression result type must be integer or float. Got "%s".';
|
||||||
|
// rsTDistParamError = 'Function tdist() requires parameter "tails" to be 1 or 2. Get %d.';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -7,9 +7,15 @@
|
|||||||
for details about the license.
|
for details about the license.
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
Author: Werner Pamler
|
AUTHOR: Werner Pamler
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
Set/unset the define MATH_EXPRESSIONS to get/remove design-time access to
|
||||||
|
functions declared in the unit Math. For runtime-only access call
|
||||||
|
"ExtendExprBuiltIns()".
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit TAExpressionSeries;
|
unit TAExpressionSeries;
|
||||||
|
|
||||||
{$H+}
|
{$H+}
|
||||||
@ -17,8 +23,8 @@ unit TAExpressionSeries;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Graphics, typ, Types, SysUtils, fpexprpars,
|
Classes, Graphics, SysUtils, fpexprpars,
|
||||||
TAChartUtils, TAFuncSeries;
|
TAChartUtils, TADrawUtils, TAFuncSeries;
|
||||||
|
|
||||||
type
|
type
|
||||||
TExpressionSeries = class;
|
TExpressionSeries = class;
|
||||||
@ -27,23 +33,27 @@ type
|
|||||||
private
|
private
|
||||||
FName: String;
|
FName: String;
|
||||||
FValue: Double;
|
FValue: Double;
|
||||||
|
procedure ParamChanged(ASender: TObject);
|
||||||
|
procedure SetName(const AValue: String);
|
||||||
|
procedure SetValue(const AValue: Double);
|
||||||
public
|
public
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
published
|
published
|
||||||
property Name: String read FName write FName;
|
property Name: String read FName write SetName;
|
||||||
property Value: Double read FValue write FValue;
|
property Value: Double read FValue write SetValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TChartExprParams = class(TCollection)
|
TChartExprParams = class(TCollection)
|
||||||
private
|
private
|
||||||
FParser: TFpExpressionParser;
|
FParser: TFpExpressionParser;
|
||||||
|
FSeries: TExpressionSeries;
|
||||||
function GetP(AIndex: Integer): TChartExprParam;
|
function GetP(AIndex: Integer): TChartExprParam;
|
||||||
procedure SetP(AIndex: Integer; AValue: TChartExprParam);
|
procedure SetP(AIndex: Integer; AValue: TChartExprParam);
|
||||||
protected
|
protected
|
||||||
procedure UpdateIdentifier(const AName: String; const AValue: Double);
|
procedure Changed;
|
||||||
public
|
public
|
||||||
|
constructor Create(ASeries: TExpressionSeries);
|
||||||
function AddParam(const AName: String; const AValue: Double): TChartExprParam;
|
function AddParam(const AName: String; const AValue: Double): TChartExprParam;
|
||||||
procedure Update(AItem: TCollectionItem); override;
|
|
||||||
property Params[AIndex: Integer]: TChartExprParam read GetP write SetP; default;
|
property Params[AIndex: Integer]: TChartExprParam read GetP write SetP; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -73,14 +83,15 @@ type
|
|||||||
|
|
||||||
TExpressionSeries = class(TCustomFuncSeries)
|
TExpressionSeries = class(TCustomFuncSeries)
|
||||||
private
|
private
|
||||||
FParser: TFpExpressionParser;
|
FDomain: String;
|
||||||
|
FDomainEpsilon: Double;
|
||||||
FDomainScanner: TChartDomainScanner;
|
FDomainScanner: TChartDomainScanner;
|
||||||
|
FExpression: String;
|
||||||
FParams: TChartExprParams;
|
FParams: TChartExprParams;
|
||||||
FX: TFPExprIdentifierDef;
|
FParser: TFpExpressionParser;
|
||||||
FVariable: String;
|
FVariable: String;
|
||||||
function GetDomain: String;
|
FX: TFPExprIdentifierDef;
|
||||||
function GetDomainEpsilon: Double;
|
FDirty: Boolean;
|
||||||
function GetExpression: String;
|
|
||||||
procedure SetDomain(const AValue: String);
|
procedure SetDomain(const AValue: String);
|
||||||
procedure SetDomainEpsilon(const AValue: Double);
|
procedure SetDomainEpsilon(const AValue: Double);
|
||||||
procedure SetExpression(const AValue: string);
|
procedure SetExpression(const AValue: string);
|
||||||
@ -88,47 +99,87 @@ type
|
|||||||
procedure SetVariable(const AValue: String);
|
procedure SetVariable(const AValue: String);
|
||||||
protected
|
protected
|
||||||
function DoCalculate(AX: Double): Double; override;
|
function DoCalculate(AX: Double): Double; override;
|
||||||
|
procedure GetBounds(var ABounds: TDoubleRect); override;
|
||||||
|
procedure SetupParser;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Assign(ASource: TPersistent); override;
|
procedure Assign(ASource: TPersistent); override;
|
||||||
|
procedure Draw(ADrawer: IChartDrawer); override;
|
||||||
function IsEmpty: Boolean; override;
|
function IsEmpty: Boolean; override;
|
||||||
|
procedure RequestParserUpdate; inline;
|
||||||
published
|
published
|
||||||
property Domain: String read GetDomain write SetDomain;
|
property DomainEpsilon: Double read FDomainEpsilon write SetDomainEpsilon;
|
||||||
property DomainEpsilon: Double read GetDomainEpsilon write SetDomainEpsilon;
|
|
||||||
property Expression: String read GetExpression write SetExpression;
|
|
||||||
property Params: TChartExprParams read FParams write SetParams;
|
property Params: TChartExprParams read FParams write SetParams;
|
||||||
property Variable: String read FVariable write SetVariable;
|
property Variable: String read FVariable write SetVariable;
|
||||||
|
property Domain: String read FDomain write SetDomain;
|
||||||
|
property Expression: String read FExpression write SetExpression;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ExtendExprBuiltins;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, TAGraph, TAChartStrConsts;
|
Math,
|
||||||
|
TAGraph, TAChartStrConsts;
|
||||||
|
|
||||||
{ TChartExprParam }
|
|
||||||
|
{ TChartExprParam }
|
||||||
|
|
||||||
procedure TChartExprParam.Assign(Source: TPersistent);
|
procedure TChartExprParam.Assign(Source: TPersistent);
|
||||||
begin
|
begin
|
||||||
if Source is TChartExprParam then begin
|
if Source is TChartExprParam then begin
|
||||||
FName := TChartExprParam(Source).Name;
|
FName := TChartExprParam(Source).Name;
|
||||||
FValue := TChartExprParam(Source).Value;
|
FValue := TChartExprParam(Source).Value;
|
||||||
end else
|
end;
|
||||||
inherited Assign(Source);
|
inherited Assign(Source);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChartExprParam.ParamChanged(ASender: TObject);
|
||||||
|
begin
|
||||||
|
Unused(ASender);
|
||||||
|
TChartExprParams(Collection).Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChartExprParam.SetName(const AValue: String);
|
||||||
|
begin
|
||||||
|
if AValue = FName then exit;
|
||||||
|
FName := AValue;
|
||||||
|
ParamChanged(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChartExprParam.SetValue(const AValue: Double);
|
||||||
|
begin
|
||||||
|
if AValue = FValue then exit;
|
||||||
|
FValue := AValue;
|
||||||
|
ParamChanged(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TChartExprParams }
|
{ TChartExprParams }
|
||||||
|
|
||||||
|
constructor TChartExprParams.Create(ASeries: TExpressionSeries);
|
||||||
|
begin
|
||||||
|
inherited Create(TChartExprParam);
|
||||||
|
FSeries := ASeries;
|
||||||
|
FParser := ASeries.FParser;
|
||||||
|
end;
|
||||||
|
|
||||||
function TChartExprParams.AddParam(const AName: String;
|
function TChartExprParams.AddParam(const AName: String;
|
||||||
const AValue: Double): TChartExprParam;
|
const AValue: Double): TChartExprParam;
|
||||||
begin
|
begin
|
||||||
Result := Add as TChartExprParam;
|
Result := Add as TChartExprParam;
|
||||||
Result.FName := AName;
|
Result.FName := AName;
|
||||||
Result.FValue := AValue;
|
Result.FValue := AValue;
|
||||||
UpdateIdentifier(AName, AValue);
|
FSeries.RequestParserUpdate;
|
||||||
//Changed;
|
end;
|
||||||
|
|
||||||
|
procedure TChartExprParams.Changed;
|
||||||
|
begin
|
||||||
|
FSeries.RequestParserUpdate;
|
||||||
|
FSeries.UpdateParentChart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChartExprParams.GetP(AIndex: Integer): TChartExprParam;
|
function TChartExprParams.GetP(AIndex: Integer): TChartExprParam;
|
||||||
@ -140,31 +191,6 @@ procedure TChartExprParams.SetP(AIndex: Integer;
|
|||||||
AValue: TChartExprParam);
|
AValue: TChartExprParam);
|
||||||
begin
|
begin
|
||||||
Items[AIndex] := AValue;
|
Items[AIndex] := AValue;
|
||||||
UpdateIdentifier(AValue.Name, AValue.Value);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChartExprParams.Update(AItem: TCollectionItem);
|
|
||||||
var
|
|
||||||
p: TChartExprParam;
|
|
||||||
begin
|
|
||||||
if Assigned(FParser) then begin
|
|
||||||
p := TChartExprParam(AItem);
|
|
||||||
if p <> nil then UpdateIdentifier(p.Name, p.Value);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChartExprParams.UpdateIdentifier(const AName: String;
|
|
||||||
const AValue: Double);
|
|
||||||
var
|
|
||||||
ident: TFpExprIdentifierDef;
|
|
||||||
s: String;
|
|
||||||
begin
|
|
||||||
Str(AValue:0, s);
|
|
||||||
ident := FParser.Identifiers.FindIdentifier(AName);
|
|
||||||
if ident = nil then
|
|
||||||
FParser.Identifiers.AddFloatVariable(AName, AValue)
|
|
||||||
else
|
|
||||||
ident.Value := s;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -244,10 +270,7 @@ type
|
|||||||
var
|
var
|
||||||
a, b: Double;
|
a, b: Double;
|
||||||
i, j: Integer;
|
i, j: Integer;
|
||||||
intervalWithStart: Boolean;
|
|
||||||
intervalWithEnd: Boolean;
|
|
||||||
points: array of TIntervalPoint;
|
points: array of TIntervalPoint;
|
||||||
npoints: Integer;
|
|
||||||
begin
|
begin
|
||||||
if ADomain.IntervalCount = 0 then
|
if ADomain.IntervalCount = 0 then
|
||||||
exit;
|
exit;
|
||||||
@ -396,23 +419,26 @@ end;
|
|||||||
constructor TExpressionSeries.Create(AOwner: TComponent);
|
constructor TExpressionSeries.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
FDirty := true;
|
||||||
|
|
||||||
FVariable := 'x';
|
FVariable := 'x';
|
||||||
|
FExpression := 'x';
|
||||||
|
|
||||||
FParser := TFpExpressionParser.Create(self);
|
FParser := TFpExpressionParser.Create(self);
|
||||||
FParser.BuiltIns := [bcMath];
|
FParser.BuiltIns := [bcMath];
|
||||||
FX := FParser.Identifiers.AddFloatVariable(FVariable, 0.0);
|
FX := FParser.Identifiers.AddFloatVariable(FVariable, 0.0);
|
||||||
FParser.Expression := FVariable;
|
|
||||||
|
|
||||||
FDomainScanner := TChartDomainScanner.Create(self);
|
FDomainScanner := TChartDomainScanner.Create(self);
|
||||||
FDomainScanner.Epsilon := DEFAULT_EPSILON;
|
FDomainEpsilon := DEFAULT_EPSILON;
|
||||||
|
|
||||||
FParams := TChartExprParams.Create(TChartExprParam);
|
FParams := TChartExprParams.Create(self);
|
||||||
FParams.FParser := FParser;
|
FParams.FParser := FParser;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TExpressionSeries.Destroy;
|
destructor TExpressionSeries.Destroy;
|
||||||
begin
|
begin
|
||||||
FX := nil;
|
FX := nil;
|
||||||
|
FParams.Free;
|
||||||
FDomainScanner.Free;
|
FDomainScanner.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
@ -445,19 +471,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TExpressionSeries.GetDomain: String;
|
procedure TExpressionSeries.Draw(ADrawer: IChartDrawer);
|
||||||
begin
|
begin
|
||||||
Result := FDomainScanner.Expression;
|
SetupParser;
|
||||||
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TExpressionSeries.GetDomainEpsilon: Double;
|
procedure TExpressionSeries.GetBounds(var ABounds: TDoubleRect);
|
||||||
begin
|
begin
|
||||||
Result := FDomainScanner.Epsilon;
|
SetupParser;
|
||||||
end;
|
inherited;
|
||||||
|
|
||||||
function TExpressionSeries.GetExpression: String;
|
|
||||||
begin
|
|
||||||
Result := FParser.Expression;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TExpressionSeries.IsEmpty: Boolean;
|
function TExpressionSeries.IsEmpty: Boolean;
|
||||||
@ -465,10 +488,16 @@ begin
|
|||||||
Result := FParser.Expression <> '';
|
Result := FParser.Expression <> '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TExpressionSeries.RequestParserUpdate;
|
||||||
|
begin
|
||||||
|
FDirty := true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TExpressionSeries.SetDomain(const AValue: String);
|
procedure TExpressionSeries.SetDomain(const AValue: String);
|
||||||
begin
|
begin
|
||||||
FDomainScanner.Expression := AValue;
|
if FDomain = AValue then exit;
|
||||||
FDomainScanner.ExtractDomainExclusions(DomainExclusions);
|
FDomain := AValue;
|
||||||
|
RequestParserUpdate;
|
||||||
UpdateParentChart;
|
UpdateParentChart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -479,31 +508,51 @@ end;
|
|||||||
|
|
||||||
procedure TExpressionSeries.SetExpression(const AValue: String);
|
procedure TExpressionSeries.SetExpression(const AValue: String);
|
||||||
begin
|
begin
|
||||||
FParser.Expression := AValue;
|
if FParser.Expression = AValue then
|
||||||
if not (FParser.ResultType in [rtInteger, rtFLoat]) then
|
exit;
|
||||||
raise EExprParser.CreateFmt(rsErrInvalidResultType, [ResultTypeName(FParser.ResultType)]);
|
FExpression := AValue;
|
||||||
|
RequestParserUpdate;
|
||||||
UpdateParentChart;
|
UpdateParentChart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TExpressionSeries.SetParams(const AValue: TChartExprParams);
|
procedure TExpressionSeries.SetParams(const AValue: TChartExprParams);
|
||||||
|
begin
|
||||||
|
RequestParserUpdate;
|
||||||
|
FParams.Assign(AValue);
|
||||||
|
UpdateParentChart;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TExpressionSeries.SetupParser;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
p: TChartExprParam;
|
p: TChartExprParam;
|
||||||
begin
|
begin
|
||||||
FParams.Assign(AValue);
|
if (not FDirty) then
|
||||||
|
exit;
|
||||||
|
|
||||||
FParser.Identifiers.Clear;
|
FParser.Identifiers.Clear;
|
||||||
FX := FParser.Identifiers.AddFloatVariable(FVariable, 0.0);
|
FX := FParser.Identifiers.AddFloatVariable(FVariable, 0.0);
|
||||||
for i:=0 to FParams.Count-1 do begin
|
for i:=0 to FParams.Count-1 do begin
|
||||||
p := FParams[i];
|
p := FParams[i];
|
||||||
FParser.Identifiers.AddFloatVariable(p.Name, p.Value);
|
FParser.Identifiers.AddFloatVariable(p.Name, p.Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FDomainScanner.Epsilon := FDomainEpsilon;
|
||||||
|
FDomainScanner.Expression := FDomain;
|
||||||
|
FDomainScanner.ExtractDomainExclusions(DomainExclusions);
|
||||||
|
|
||||||
|
FParser.Expression := FExpression;
|
||||||
|
if not (FParser.ResultType in [rtInteger, rtFLoat]) then
|
||||||
|
raise EExprParser.CreateFmt(rsErrInvalidResultType, [ResultTypeName(FParser.ResultType)]);
|
||||||
|
|
||||||
|
FDirty := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TExpressionSeries.SetVariable(const AValue: String);
|
procedure TExpressionSeries.SetVariable(const AValue: String);
|
||||||
begin
|
begin
|
||||||
if FVariable = AValue then exit;
|
if FVariable = AValue then exit;
|
||||||
FVariable := AValue;
|
FVariable := AValue;
|
||||||
SetParams(FParams);
|
RequestParserUpdate;
|
||||||
UpdateParentChart;
|
UpdateParentChart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -541,129 +590,97 @@ begin
|
|||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
Result.resFloat := cot(x);
|
Result.resFloat := cot(x);
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure ExprArcsin(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
procedure ExprArcsin(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and InRange(x, -1.0, 1.0) then
|
Result.resFloat := arcsin(x);
|
||||||
Result.resFloat := arcsin(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprArccos(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArccos(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and InRange(x, -1.0, 1.0) then
|
Result.resFloat := arccos(x);
|
||||||
Result.resFloat := arccos(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure ExprArccot(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArccot(Var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and InRange(x, -1.0, 1.0) then
|
Result.resFloat := pi/2 - arctan(x);
|
||||||
Result.resFloat := pi/2 - arctan(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprCosh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprCosh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := cosh(x);
|
||||||
Result.resFloat := cosh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprCoth(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
{ Hyperbolic cotangent coth(x); x <> 0 }
|
||||||
|
procedure ExprCoth(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and (x <> 0.0) then
|
Result.resFloat := 1/tanh(x);
|
||||||
Result.resFloat := 1/tanh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprSinh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprSinh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := sinh(x);
|
||||||
Result.resFloat := sinh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprTanh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprTanh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := tanh(x);
|
||||||
Result.resFloat := tanh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprArcosh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArcosh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and (x >= 1.0) then
|
Result.resFloat := arcosh(x);
|
||||||
Result.resFloat := arcosh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprArsinh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArsinh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgtoFloat(Args[0]);
|
x := ArgtoFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := arsinh(x);
|
||||||
Result.resFloat := arsinh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprArtanh(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArtanh(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and (x > -1.0) and (x < 1.0) then
|
Result.resFloat := artanh(x);
|
||||||
Result.resFloat := artanh(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprArcoth(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprArcoth(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) and (x < -1.0) and (x > 1.0) then
|
Result.resFloat := artanh(1.0/x);
|
||||||
Result.resFloat := artanh(1.0/x)
|
end;
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end; *)
|
|
||||||
|
|
||||||
procedure ExprSinc(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprSinc(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
@ -674,7 +691,7 @@ begin
|
|||||||
Result.resFloat := sin(x)/x;
|
Result.resFloat := sin(x)/x;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprPower(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprPower(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x,y: Double;
|
x,y: Double;
|
||||||
begin
|
begin
|
||||||
@ -683,7 +700,7 @@ begin
|
|||||||
Result.resFloat := Power(x, y);
|
Result.resFloat := Power(x, y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprHypot(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprHypot(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x,y: Double;
|
x,y: Double;
|
||||||
begin
|
begin
|
||||||
@ -691,283 +708,59 @@ begin
|
|||||||
y := ArgToFloat(Args[1]);
|
y := ArgToFloat(Args[1]);
|
||||||
Result.resFloat := Hypot(x,y);
|
Result.resFloat := Hypot(x,y);
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure ExprLg(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprLg(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := log10(x);
|
||||||
Result.resFloat := log10(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprLog10(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprLog10(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := log10(x);
|
||||||
Result.resFloat := log10(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprLog2(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprLog2(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
x := ArgToFloat(Args[0]);
|
x := ArgToFloat(Args[0]);
|
||||||
if IsNumber(x) then
|
Result.resFloat := log2(x);
|
||||||
Result.resFloat := log2(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprErf(Var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
procedure ExprMax(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
// Error function
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := speerf(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprErfc(Var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
|
||||||
// Error function complement
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := speefc(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Incomplete gamma function P
|
|
||||||
procedure ExprGammaP(var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
x, s: Double;
|
|
||||||
begin
|
|
||||||
s := ArgToFloat(Args[0]);
|
|
||||||
x := ArgToFloat(Args[1]);
|
|
||||||
if IsNumber(x) and IsNumber(s) then
|
|
||||||
Result.resFloat := gammap(s, x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Incomplete gamma function Q
|
|
||||||
procedure ExprGammaQ(var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
x, s: Double;
|
|
||||||
begin
|
|
||||||
s := ArgToFloat(Args[0]);
|
|
||||||
x := ArgToFloat(Args[1]);
|
|
||||||
if IsNumber(x) and IsNumber(s) then
|
|
||||||
Result.resFloat := gammaq(s, x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Incomplete beta function
|
|
||||||
procedure ExprBetaI(var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
a, b, x: Double;
|
|
||||||
begin
|
|
||||||
a := ArgToFloat(Args[0]);
|
|
||||||
b := ArgToFloat(Args[1]);
|
|
||||||
x := ArgToFloat(Args[2]);
|
|
||||||
if IsNumber(x) and IsNumber(a) and IsNumber(b) then
|
|
||||||
Result.resFloat := betai(a, b, x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprChi2Dist(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
n: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
n := ArgToFloat(Args[1]);
|
|
||||||
if IsNumber(x) and IsNumber(n) then
|
|
||||||
Result.resFloat := chi2dist(x, round(n))
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprtDist(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
n: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
n := ArgToFloat(Args[1]);
|
|
||||||
if IsNumber(x) and IsNumber(n) then
|
|
||||||
Result.resFloat := tdist(x, round(n))
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprFDist(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
n1, n2: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
n1 := ArgToFloat(Args[1]);
|
|
||||||
n2 := ArgToFloat(Args[2]);
|
|
||||||
if IsNumber(x) and IsNumber(n1) and IsNumber(n2) then
|
|
||||||
Result.resFloat := Fdist(x, round(n1), round(n2))
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprI0(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the first kind I0(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebi0(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprI1(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the first kind I1(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebi1(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprJ0(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the first kind J0(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebj0(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprJ1(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the first kind J1(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebj1(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprK0(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the second kind K0(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebk0(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprK1(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the second kind K1(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := spebk1(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprY0(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the second kind Y0(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := speby0(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprY1(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
// Bessel function of the second kind Y1(x)
|
|
||||||
var
|
|
||||||
x: Double;
|
|
||||||
begin
|
|
||||||
x := ArgToFloat(Args[0]);
|
|
||||||
if IsNumber(x) then
|
|
||||||
Result.resFloat := speby1(x)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ExprMax(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
|
||||||
var
|
var
|
||||||
x1, x2: Double;
|
x1, x2: Double;
|
||||||
begin
|
begin
|
||||||
x1 := ArgToFloat(Args[0]);
|
x1 := ArgToFloat(Args[0]);
|
||||||
x2 := ArgToFloat(Args[1]);
|
x2 := ArgToFloat(Args[1]);
|
||||||
if IsNumber(x1) and IsNumber(x2) then
|
Result.resFloat := Max(x1, x2);
|
||||||
Result.resFloat := Max(x1, x2)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExprMin(Var Result: TFPExpressionResult; Const Args: TExprParameterArray);
|
procedure ExprMin(var Result: TFPExpressionResult; const Args: TExprParameterArray);
|
||||||
var
|
var
|
||||||
x1, x2: Double;
|
x1, x2: Double;
|
||||||
begin
|
begin
|
||||||
x1 := ArgToFloat(Args[0]);
|
x1 := ArgToFloat(Args[0]);
|
||||||
x2 := ArgToFloat(Args[1]);
|
x2 := ArgToFloat(Args[1]);
|
||||||
if IsNumber(x1) and IsNumber(x2) then
|
Result.resFloat := Min(x1, x2);
|
||||||
Result.resFloat := Min(x1, x2)
|
|
||||||
else
|
|
||||||
Result.resFloat := NaN;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FixDecSep(const AExpression: String): String;
|
procedure ExtendExprBuiltins;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
|
||||||
Result := AExpression;
|
|
||||||
for i:=1 to Length(Result) do begin
|
|
||||||
if Result[i] = ',' then Result[i] := '.';
|
|
||||||
end;
|
|
||||||
end;*)
|
|
||||||
|
|
||||||
procedure ExtendBuiltins;
|
|
||||||
begin
|
begin
|
||||||
with BuiltinIdentifiers do begin
|
with BuiltinIdentifiers do begin
|
||||||
|
// Trigonometric and related
|
||||||
AddFunction(bcMath, 'degtorad', 'F', 'F', @ExprDegtorad);
|
AddFunction(bcMath, 'degtorad', 'F', 'F', @ExprDegtorad);
|
||||||
AddFunction(bcMath, 'radtodeg', 'F', 'F', @ExprRadtodeg);
|
AddFunction(bcMath, 'radtodeg', 'F', 'F', @ExprRadtodeg);
|
||||||
|
|
||||||
AddFunction(bcMath, 'tan', 'F', 'F', @ExprTan);
|
AddFunction(bcMath, 'tan', 'F', 'F', @ExprTan);
|
||||||
AddFunction(bcMath, 'cot', 'F', 'F', @ExprCot);
|
AddFunction(bcMath, 'cot', 'F', 'F', @ExprCot);
|
||||||
(*
|
|
||||||
AddFunction(bcMath, 'arcsin', 'F', 'F', @ExprArcSin);
|
AddFunction(bcMath, 'arcsin', 'F', 'F', @ExprArcSin);
|
||||||
AddFunction(bcMath, 'arccos', 'F', 'F', @ExprArcCos);
|
AddFunction(bcMath, 'arccos', 'F', 'F', @ExprArcCos);
|
||||||
AddFunction(bcMath, 'arccot', 'F', 'F', @ExprArcCot);
|
AddFunction(bcMath, 'arccot', 'F', 'F', @ExprArcCot);
|
||||||
@ -979,52 +772,28 @@ begin
|
|||||||
AddFunction(bcMath, 'arsinh', 'F', 'F', @ExprArsinh);
|
AddFunction(bcMath, 'arsinh', 'F', 'F', @ExprArsinh);
|
||||||
AddFunction(bcMath, 'artanh', 'F', 'F', @ExprArtanh);
|
AddFunction(bcMath, 'artanh', 'F', 'F', @ExprArtanh);
|
||||||
AddFunction(bcMath, 'arcoth', 'F', 'F', @ExprArcoth);
|
AddFunction(bcMath, 'arcoth', 'F', 'F', @ExprArcoth);
|
||||||
*)
|
|
||||||
AddFunction(bcMath, 'sinc', 'F', 'F', @ExprSinc);
|
AddFunction(bcMath, 'sinc', 'F', 'F', @ExprSinc);
|
||||||
|
|
||||||
|
// Power
|
||||||
AddFunction(bcMath, 'power', 'F', 'FF', @ExprPower);
|
AddFunction(bcMath, 'power', 'F', 'FF', @ExprPower);
|
||||||
AddFunction(bcMath, 'hypot', 'F', 'FF', @ExprHypot);
|
AddFunction(bcMath, 'hypot', 'F', 'FF', @ExprHypot);
|
||||||
|
|
||||||
(*
|
// Logarithm
|
||||||
AddFunction(bcMath, 'lg', 'F', 'F', @ExprLog10);
|
AddFunction(bcMath, 'lg', 'F', 'F', @ExprLog10);
|
||||||
AddFunction(bcMath, 'log10', 'F', 'F', @ExprLog10);
|
AddFunction(bcMath, 'log10', 'F', 'F', @ExprLog10);
|
||||||
AddFunction(bcMath, 'log2', 'F', 'F', @ExprLog2);
|
AddFunction(bcMath, 'log2', 'F', 'F', @ExprLog2);
|
||||||
|
|
||||||
// Error function
|
|
||||||
AddFunction(bcMath, 'erf', 'F', 'F', @ExprErf);
|
|
||||||
AddFunction(bcMath, 'erfc', 'F', 'F', @ExprErfc);
|
|
||||||
|
|
||||||
// Incomplete gamma and beta functions
|
|
||||||
AddFunction(bcMath, 'gammap', 'F', 'FF', @ExprGammaP);
|
|
||||||
AddFunction(bcMath, 'gammaq', 'F', 'FF', @ExprGammaQ);
|
|
||||||
AddFunction(bcMath, 'betai', 'F', 'FFF', @ExprBetaI);
|
|
||||||
|
|
||||||
// Probability distributions
|
|
||||||
AddFunction(bcMath, 'chi2dist', 'F', 'FI', @ExprChi2Dist);
|
|
||||||
AddFunction(bcMath, 'tdist', 'F', 'FI', @Exprtdist);
|
|
||||||
AddFunction(bcMath, 'Fdist', 'F', 'FII', @ExprFDist);
|
|
||||||
|
|
||||||
// Bessel functions of the first kind
|
|
||||||
AddFunction(bcMath, 'I0', 'F', 'F', @ExprI0);
|
|
||||||
AddFunction(bcMath, 'I1', 'F', 'F', @ExprI1);
|
|
||||||
AddFunction(bcMath, 'J0', 'F', 'F', @ExprJ0);
|
|
||||||
AddFunction(bcMath, 'J1', 'F', 'F', @ExprJ1);
|
|
||||||
|
|
||||||
// Bessel functions of the second kind
|
|
||||||
AddFunction(bcMath, 'K0', 'F', 'F', @ExprK0);
|
|
||||||
AddFunction(bcMath, 'K1', 'F', 'F', @ExprK1);
|
|
||||||
AddFunction(bcMath, 'Y0', 'F', 'F', @ExprY0);
|
|
||||||
AddFunction(bcMath, 'Y1', 'F', 'F', @ExprY1);
|
|
||||||
|
|
||||||
// Max/min
|
// Max/min
|
||||||
AddFunction(bcMath, 'max', 'F', 'FF', @ExprMax);
|
//AddFunction(bcMath, 'max', 'F', 'FF', @ExprMax);
|
||||||
AddFunction(bcMath, 'min', 'F', 'FF', @ExprMin);
|
//AddFunction(bcMath, 'min', 'F', 'FF', @ExprMin);
|
||||||
*)
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
ExtendBuiltins;
|
{$IFDEF MATH_EXPRESSIONS}
|
||||||
|
ExtendExprBuiltins;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
RegisterSeriesClass(TExpressionSeries, @rsExpressionSeries);
|
RegisterSeriesClass(TExpressionSeries, @rsExpressionSeries);
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -638,8 +638,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFuncSeries.GetBounds(var ABounds: TDoubleRect);
|
procedure TFuncSeries.GetBounds(var ABounds: TDoubleRect);
|
||||||
var
|
|
||||||
ymin, ymax: Double;
|
|
||||||
begin
|
begin
|
||||||
inherited GetBounds(ABounds);
|
inherited GetBounds(ABounds);
|
||||||
if Assigned(OnCalculate) then
|
if Assigned(OnCalculate) then
|
||||||
|
@ -15,7 +15,7 @@ function HTMLToFPColor(const AText: String): TFPColor;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, math, contnrs, htmldefs, LazUTF8,
|
SysUtils, htmldefs, LazUTF8,
|
||||||
TAChartUtils, TAGeometry;
|
TAChartUtils, TAGeometry;
|
||||||
|
|
||||||
function ReplaceHTMLEntities(const AText: String): String;
|
function ReplaceHTMLEntities(const AText: String): String;
|
||||||
|
Loading…
Reference in New Issue
Block a user