procedure TForm1.Button1Click(Sender: TObject); var y, yInDegree, EPS, diff, x, yMinus1 : Extended; i, n : Cardinal; begin x := StrToFloat(Edit1.Text); n := StrToInt(Edit3.Text); EPS := StrToFloat(Edit2.Text); i := 1; y := 1.0; yInDegree := 1.0; while (diff > EPS) do begin yMinus1 := y; y := ((1/n) * ((n-1) * y + (x/yInDegree))); // <<<-- Ошибка тут yInDegree := exp(n*ln(y)); diff := y - yMinus1; inc(i); end; Label5.Caption := IntToStr(i); end; Error text:
Project Project1.exe raised exception class EInvalidOp with message 'Invalid floating point operation'
The error takes off on the line y := ((1/n) * ((n-1) * y + (x/yInDegree))); .