Extended math RTL

This commit is contained in:
Michael Schimmel
2026-01-13 18:08:52 +01:00
parent 1c6a6fe5a0
commit 629dbc97ca
6 changed files with 457 additions and 90 deletions
+11 -6
View File
@@ -620,12 +620,17 @@ begin
if (A.Kind in [TKind.DateTime, TKind.Keyword, TKind.Boolean]) or (B.Kind in [TKind.DateTime, TKind.Keyword, TKind.Boolean]) then
raise EArgumentException.CreateFmt('Operator Divide not supported for types %s and %s', [A.Kind.ToString, B.Kind.ToString]);
var valB: Double := B;
if valB = 0.0 then
raise EDivByZero.Create('Division by zero');
var valA: Double := A;
Result := valA / valB;
if B.Kind in [TKind.Float, TKind.DateTime] then
begin
Result := A.Value.AsDouble / B.Value.AsDouble;
end
else
begin
var valB: Int64 := B;
if valB = 0 then
raise EDivByZero.Create('Division by zero');
Result := A.Value.AsDouble / valB;
end;
end;
class operator TScalar.IntDivide(const A, B: TScalar): TScalar;