Код на Delphi. После запуска ввожу в поле значение для H (с запятой, т.к вещественное число), запускаю сию процедуру. Выскакивает ошибка "Invalid floating point operation". Помогите найти, пожалуйста.
procedure TForm1.Button1Click(Sender: TObject);
const
Xmin = -3.0;
Xmax = 3.0;
var
W, y, H, x: real;
i: integer;
begin
i := 1;
x := Xmin;
Series1.Clear;
H := StrToFloat(Edit1.Text);
StringGrid1.Cells[0, 0] := 'x';
StringGrid1.Cells[1, 0] := 'W';
StringGrid1.Cells[2, 0] := 'y';
repeat
if ((x > 0.1) and (x < 2.0)) then
W := ln(x) + Exp((1 / 3) * ln(x))
else if (x <= 0.1) then
W := 4 * x + Exp(2 * ln(Sin(x)))
else
W := 2.6 * Exp(2 * ln(x) - 3.7);
y := (ln(Exp(2*ln(W)) + W + 1) * cos(4 * x)) / (Exp(-2) + 2);
Series1.AddXY(x, y);
StringGrid1.Cells[0, i] := FloatToStr(y);
StringGrid1.Cells[1, i] := FloatToStr(W);
StringGrid1.Cells[2, i] := FloatToStr(x);
x := x + H;
i := i + 1;
until x >= Xmax;
end;