var Form1: TForm1; a,b,c,x1,x2,d: real; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin a:=StrToFloat(Edit1.Text); b:=StrToFloat(Edit1.Text) ; c:=StrToFloat(Edit1.Text) ; d:=sqr(b)-4*a*c; if d>0 then begin try x1:=(-b+sqrt(d))/(2*a); x2:=(-b-sqrt(d))/(2*a); except on EzeroDivide do MessageDLG('Ділення на 0!',mtInformation,[mbOK],0); end; ShowMessage('x1='+FloatToStr(x1)+',x2='+FloatToStr(x2)); end else if d=0 then begin try x1:=(-b)/(2*a); //здесь вылетает ошибка Invalid floating point operation except on EzeroDivide do MessageDLG('Ділення на 0!',mtInformation,[mbOK],0); end; ShowMessage('x='+FloatToStr(x1)); end else if d<0 then begin try x1:=(-b+sqrt(abs(d)))/(2*a); x2:=(-b-sqrt(abs(d)))/(2*a); except on EzeroDivide do MessageDLG('Ділення на 0!',mtInformation,[mbOK],0); end; ShowMessage('x1='+FloatToStr(x1)+',x2='+FloatToStr(x2)); end end; end.
So, tell me, please, what is wrong and how to deal with it?