error "invalid floating poin operation" en pascal
Publicado por carlos eduardo orrego (3 intervenciones) el 28/10/2009 20:03:27
al compilar el programa en Turbo pascal no me sale ningun error pero al ejecutar me da el error siguiente y se detiene. Me da el error "Invalid floating point operation".
alguien podria ayudarme? A continuacion pongo el codigo.
Program tirante;
uses crt;
Var A,b,z,y,p,T,f,q,S,n,ff,dy,r,v,F1,e1,exp1,exp2,exp3:real;
Function pot(Num,Expo:real):real;
begin
pot:=Exp(Expo*Ln(Num));
end;
procedure subnortrapezoidal;
begin
A:=(b+z*y)*y;
p:=b+2*y*sqrt(1+z*z);
T:=b+2*z*y;
exp1:=5/3;
exp2:=1/2;
exp3:=2/3;
f:=q-pot(A,exp1)*pot(S,exp2)/(pot(p,exp3)*n);
end;
begin
clrscr;
writeln('Ingrese los datos');
writeln('*****************');
Write('Caudal Q(m3/s) = ');readln(q);
write('Ancho de solera b(m) = ');readln(b);
write('Talud Z = ');readln(z);
write('Rugosidad n = ');readln(n);
write('Pendiente S = ');readln(S);
ff:=0.000001;
f:= 0.000001;
y:= 0.000001;
repeat
subnortrapezoidal;
ff:=f;
y:=y-0.001;
subnortrapezoidal;
dy:=0.001*ff/(ff-f);
y:=y-dy+0.001;
until ABS(dy)>=0.00001;
r:=A/p;
v:=q/A;
F1:=v/sqrt(9.81*A/T);
e1:=y+v*v/19.62;
writeln('Resultado:');
writeln('**********');
Write('y:=',y:5:4);
Write('A:=',A:5:4);
Write('T:=',T:5:4);
Write('F:=',F1:5:4);
Write('p:=',p:5:4);
Write('v:=',v:5:4);
Write('E:=',e1:5:4);
readln;
end.
alguien podria ayudarme? A continuacion pongo el codigo.
Program tirante;
uses crt;
Var A,b,z,y,p,T,f,q,S,n,ff,dy,r,v,F1,e1,exp1,exp2,exp3:real;
Function pot(Num,Expo:real):real;
begin
pot:=Exp(Expo*Ln(Num));
end;
procedure subnortrapezoidal;
begin
A:=(b+z*y)*y;
p:=b+2*y*sqrt(1+z*z);
T:=b+2*z*y;
exp1:=5/3;
exp2:=1/2;
exp3:=2/3;
f:=q-pot(A,exp1)*pot(S,exp2)/(pot(p,exp3)*n);
end;
begin
clrscr;
writeln('Ingrese los datos');
writeln('*****************');
Write('Caudal Q(m3/s) = ');readln(q);
write('Ancho de solera b(m) = ');readln(b);
write('Talud Z = ');readln(z);
write('Rugosidad n = ');readln(n);
write('Pendiente S = ');readln(S);
ff:=0.000001;
f:= 0.000001;
y:= 0.000001;
repeat
subnortrapezoidal;
ff:=f;
y:=y-0.001;
subnortrapezoidal;
dy:=0.001*ff/(ff-f);
y:=y-dy+0.001;
until ABS(dy)>=0.00001;
r:=A/p;
v:=q/A;
F1:=v/sqrt(9.81*A/T);
e1:=y+v*v/19.62;
writeln('Resultado:');
writeln('**********');
Write('y:=',y:5:4);
Write('A:=',A:5:4);
Write('T:=',T:5:4);
Write('F:=',F1:5:4);
Write('p:=',p:5:4);
Write('v:=',v:5:4);
Write('E:=',e1:5:4);
readln;
end.
Valora esta pregunta


0