Extended math RTL
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user