rocedure TForm1.Button2Click(Sender: TObject);
var
XL,XU,XR,FXL,FXU,FXR,producto,error,Eros,m1,m2:double;
n1,n2,n3,n4,n5,n6,n7:double;
begin
xl:=strtofloat(int1.Text);
xu:=strtofloat(int2.text);
eros:= strtofloat(edit1.Text);
Error:=100;
{ahora sacamos n1=orden0,n2=orden1,n3=orden2,n4=orden3,n5=orden4,n6=orden5 y n7=orden6}
n1:=strtofloat(edit8.Text); n2:=strtofloat(edit7.Text); n3:=strtofloat(edit6.Text);
n4:=strtofloat(edit5.Text); n5:=strtofloat(edit4.Text); n6:=strtofloat(edit3.Text);
n7:=strtofloat(edit2.Text);
while (error>eros) do
begin
FXL:= (N1*XL)+(N2*XL)+(N3*XL)+(N4*XL)+(N5*XL)+(N6*XL)+(N7*XL);
FXU:= (N1*XU)+(N2*XU)+(N3*XU)+(N4*XU)+(N5*XU)+(N6*XU)+(N7*XL); {PRIMER PASO}
m1:= fxl*fxu;
XR:=(XL+XU)/2; {PASO 2}
FXR:= (N1*XR)+(N2*XR)+(N3*XR)+(N4*XR)+(N5*XR)+(N6*XR)+(N7*XR);
m2:= FXL*FXR;
if m2<0 then
begin {inciso a}
xu:=xr;
FXU:=FXR;
end
else
begin {inciso b}
xl:=xr;
FXL:= FXR;
end;
error:= ((xu-xl)/xu)*100;
floattostr(error);
error:= Abs(error);
end;//while
label12.Caption:='MARGEN DE ERROR ES '+floattostr(error);
end;//proceso