diff --git a/UPolynomial.pas b/UPolynomial.pas index 9a4374f..aa3467d 100644 --- a/UPolynomial.pas +++ b/UPolynomial.pas @@ -38,8 +38,8 @@ type property Degree: Integer read GetDegree; property Coefficient[const AIndex: Integer]: TBigInt read GetCoefficient; function CalcValueAt(const AX: Int64): TBigInt; - function IsEqualTo(const AOther: TBigIntPolynomial): Boolean; function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial; + function IsEqualTo(const AOther: TBigIntPolynomial): Boolean; function ToString: string; class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static; end; @@ -72,24 +72,6 @@ begin Result := Result * AX + FCoefficients[i]; end; -function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean; -var - i: Integer; -begin - if Length(FCoefficients) = Length(AOther.FCoefficients) then - begin - Result := True; - for i := 0 to Length(FCoefficients) - 1 do - if FCoefficients[i] <> AOther.FCoefficients[i] then - begin - Result := False; - Break; - end; - end - else - Result := False; -end; - function TBigIntPolynomial.ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial; var len, i: Integer; @@ -110,6 +92,24 @@ begin SetLength(Result.FCoefficients, 0); end; +function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean; +var + i: Integer; +begin + if Length(FCoefficients) = Length(AOther.FCoefficients) then + begin + Result := True; + for i := 0 to Length(FCoefficients) - 1 do + if FCoefficients[i] <> AOther.FCoefficients[i] then + begin + Result := False; + Break; + end; + end + else + Result := False; +end; + function TBigIntPolynomial.ToString: string; var i: Integer;