Can use TRUNC or ROUND functions in expression?
example:
- expression: ROUND(2.9)
- result: 3
Can use TRUNC or ROUND functions in expression?
example:
By default, the engine has ceil, floor, and frac functions (see documentation). But you can add your own function as a descendant.
I share my sample of final solution:
unit JPF.Analytix;
{ 20240411 omarperezh,
how to use: add in uses JPF.Analytix
sample: myround(2.5)=3, myround(2.4)=2 }
interface
uses
Base.Types,
Base.Assemblies,
Analytix.Functions;
Type
///
procedure InitializeAssembly;
implementation
procedure InitializeAssembly;
begin
TClassFinder.InstantiateClass(TMyRound);
end;
{ TMyRound }
function TMyRound.Func(const x: TFloat): TFloat;
begin
result := ROUND(x);
end;
function TMyRound.GetName: string;
begin
result := 'myround';
end;
class function TMyRound.IsRealized: boolean;
begin
result := true;
end;
initialization
InitializeAssembly;
end.