Added TBigIntPolynomial.ToString
This commit is contained in:
parent
d503968cee
commit
7ac4a3519a
|
@ -40,6 +40,7 @@ type
|
|||
function CalcValueAt(const AX: Int64): TBigInt;
|
||||
function IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||
function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
||||
function ToString: string;
|
||||
class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static;
|
||||
end;
|
||||
|
||||
|
@ -109,6 +110,18 @@ begin
|
|||
SetLength(Result.FCoefficients, 0);
|
||||
end;
|
||||
|
||||
function TBigIntPolynomial.ToString: string;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := FCoefficients[0].ToString;
|
||||
for i := 1 to Length(FCoefficients) - 1 do
|
||||
if i > 1 then
|
||||
Result := Result + ' + ' + FCoefficients[i].ToString + ' * x^' + IntToStr(i)
|
||||
else
|
||||
Result := Result + ' + ' + FCoefficients[i].ToString + ' * x';
|
||||
end;
|
||||
|
||||
class function TBigIntPolynomial.Create(const ACoefficients: array of TBigInt): TBigIntPolynomial;
|
||||
var
|
||||
high, i: integer;
|
||||
|
|
Loading…
Reference in New Issue