Board index » delphi » Division by zero during batch I/O

Division by zero during batch I/O

I am having a runtime division by zero error during batch I/O in TP7 for
DOS.  Can anyone help?

Thanks in advance.
clink84
--
     /^\
    /cN7\
    |lA2|
    |iR1|
   /|n#7|\
  / |k 0| \
 /__\8  /__\
     \4/
     /_\
    :::::
     :::
      :

 

Re:Division by zero during batch I/O


Quote
clink84 wrote:
> I am having a runtime division by zero error during batch I/O in TP7 for
> DOS.  Can anyone help?

> Thanks in advance.
> clink84
> --
>      /^\
>     /cN7\
>     |lA2|
>     |iR1|
>    /|n#7|\
>   / |k 0| \
>  /__\8  /__\
>      \4/
>      /_\
>     :::::
>      :::
>       :

How fast is your PC? Do you know about the BP/TP 200 MHz Bug?
Can you post the part of the code the error happens?

Markus

Re:Division by zero during batch I/O


600 MHz PIII, No, Yes, here is the code:

    {Geodesic}

F:=Sin(E1)*Sin(E2)-Cos(E1)*Cos(E2)*(Cos(A1)*Cos(A2)-Sin(A1)*Sin(A2));
                 D:=1-Sqr(F);
                 D1:=(Cos(E1)*Cos(A1)+F*Cos(E2)*Cos(A2))/D;
                 D2:=(Cos(E2)*Cos(A2)+F*Cos(E1)*Cos(A1))/D;
                 A:=B*(Sin(E1)+Sin(E2))*((D1*D2)/(D1+D2));

C:=Abs((Cos(E2)*Sin(E1)*Sin(A2)-Cos(E1)*Sin(E2)*Sin(A1))/(A*Sqrt
(D)))*100*B;
                 {Geodesic}
                 Write(RocAltOutput,NarNum:7,A:11:2,C:9:2);
                 Average:=A;
                 {Vertical Midpoint}
                 D:=Sin(A1+A2);
                 H1:=B*(Sin(A2)*Sin(E1))/(D*Cos(E1));
                 H2:=B*(Sin(A1)*Sin(E2))/(D*Cos(E2));
                 A:=(H1+H2)/2;
                 C:=Abs((H1-H2)/(2*A))*100;
                 {Vertical Midpoint}
                 Average:=(Average+A)/2; {average becomes average of the two
altitudes}
                 Writeln(RocAltOutput,A:17:2,C:9:2,Average:11:2);
               End;

--
       /^\
      / N \
     /c A S\
     |l R E|
     |i # C|
     |n 7 #|
    /|k 2 5|\
   / |8 1 7| \
  /  \4 7 6/  \
 /____\ 0 /____\
      /___\
      :::::
       :::
        :

Quote
Markus Humm <markus.h...@freenet.de> wrote in message

news:3B83FBCB.8090303@freenet.de...
Quote
> clink84 wrote:
> > I am having a runtime division by zero error during batch I/O in TP7 for
> > DOS.  Can anyone help?

> > Thanks in advance.
> > clink84
> > --
> >      /^\
> >     /cN7\
> >     |lA2|
> >     |iR1|
> >    /|n#7|\
> >   / |k 0| \
> >  /__\8  /__\
> >      \4/
> >      /_\
> >     :::::
> >      :::
> >       :

> How fast is your PC? Do you know about the BP/TP 200 MHz Bug?
> Can you post the part of the code the error happens?

> Markus

Re:Division by zero during batch I/O


In article <KcTg7.714$Ns6.170...@news.uswest.net>,

Quote
clink84 <clin...@yahoo.com> wrote:
>600 MHz PIII, No, Yes, here is the code:

>    {Geodesic}

>F:=Sin(E1)*Sin(E2)-Cos(E1)*Cos(E2)*(Cos(A1)*Cos(A2)-Sin(A1)*Sin(A2));
>                 D:=1-Sqr(F);
>                 D1:=(Cos(E1)*Cos(A1)+F*Cos(E2)*Cos(A2))/D;
>                 D2:=(Cos(E2)*Cos(A2)+F*Cos(E1)*Cos(A1))/D;
>                 A:=B*(Sin(E1)+Sin(E2))*((D1*D2)/(D1+D2));

Is that a joke? Hoe could anyone analyze that without the values of the
variables.

Quote

>C:=Abs((Cos(E2)*Sin(E1)*Sin(A2)-Cos(E1)*Sin(E2)*Sin(A1))/(A*Sqrt
>(D)))*100*B;
>                 {Geodesic}
>                 Write(RocAltOutput,NarNum:7,A:11:2,C:9:2);
>                 Average:=A;
>                 {Vertical Midpoint}
>                 D:=Sin(A1+A2);
>                 H1:=B*(Sin(A2)*Sin(E1))/(D*Cos(E1));
>                 H2:=B*(Sin(A1)*Sin(E2))/(D*Cos(E2));
>                 A:=(H1+H2)/2;
>                 C:=Abs((H1-H2)/(2*A))*100;
>                 {Vertical Midpoint}
>                 Average:=(Average+A)/2; {average becomes average of the two
>altitudes}
>                 Writeln(RocAltOutput,A:17:2,C:9:2,Average:11:2);
>               End;

Osmo

Re:Division by zero during batch I/O


sorry about that...no it isn't a joke...it rocket altitude data
reduction...it happens no matter the values...here are the values
A1:30,E1:80,A2:40,E2:85.  It uses 2 files and converts A1,E1,A2,E2 to
radians.  B=300.  This only happens after it processes 3 sets of data and
then screws up on the 4th time.

--
       /^\
      / N \
     /c A S\
     |l R E|
     |i # C|
     |n 7 #|
    /|k 2 5|\
   / |8 1 7| \
  /  \4 7 6/  \
 /____\ 0 /____\
      /___\
      :::::
       :::
        :

Quote
Osmo Ronkanen <ronka...@cc.helsinki.fi> wrote in message

news:9m0vu5$57p$1@oravannahka.helsinki.fi...
Quote
> In article <KcTg7.714$Ns6.170...@news.uswest.net>,
> clink84 <clin...@yahoo.com> wrote:
> >600 MHz PIII, No, Yes, here is the code:

> >    {Geodesic}

> >F:=Sin(E1)*Sin(E2)-Cos(E1)*Cos(E2)*(Cos(A1)*Cos(A2)-Sin(A1)*Sin(A2));
> >                 D:=1-Sqr(F);
> >                 D1:=(Cos(E1)*Cos(A1)+F*Cos(E2)*Cos(A2))/D;
> >                 D2:=(Cos(E2)*Cos(A2)+F*Cos(E1)*Cos(A1))/D;
> >                 A:=B*(Sin(E1)+Sin(E2))*((D1*D2)/(D1+D2));

> Is that a joke? Hoe could anyone analyze that without the values of the
> variables.

> >C:=Abs((Cos(E2)*Sin(E1)*Sin(A2)-Cos(E1)*Sin(E2)*Sin(A1))/(A*Sqrt
> >(D)))*100*B;
> >                 {Geodesic}
> >                 Write(RocAltOutput,NarNum:7,A:11:2,C:9:2);
> >                 Average:=A;
> >                 {Vertical Midpoint}
> >                 D:=Sin(A1+A2);
> >                 H1:=B*(Sin(A2)*Sin(E1))/(D*Cos(E1));
> >                 H2:=B*(Sin(A1)*Sin(E2))/(D*Cos(E2));
> >                 A:=(H1+H2)/2;
> >                 C:=Abs((H1-H2)/(2*A))*100;
> >                 {Vertical Midpoint}
> >                 Average:=(Average+A)/2; {average becomes average of the
two
> >altitudes}
> >                 Writeln(RocAltOutput,A:17:2,C:9:2,Average:11:2);
> >               End;

> Osmo

Re:Division by zero during batch I/O


Scratch that request!  The program works!  It was the EOF I had to terminate
the data reading/calcualtions loop.

--
       /^\
      / N \
     /c A S\
     |l R E|
     |i # C|
     |n 7 #|
    /|k 2 5|\
   / |8 1 7| \
  /  \4 7 6/  \
 /____\ 0 /____\
      /___\
      :::::
       :::
        :

Quote
Osmo Ronkanen <ronka...@cc.helsinki.fi> wrote in message

news:9m0vu5$57p$1@oravannahka.helsinki.fi...
Quote
> In article <KcTg7.714$Ns6.170...@news.uswest.net>,
> clink84 <clin...@yahoo.com> wrote:
> >600 MHz PIII, No, Yes, here is the code:

> >    {Geodesic}

> >F:=Sin(E1)*Sin(E2)-Cos(E1)*Cos(E2)*(Cos(A1)*Cos(A2)-Sin(A1)*Sin(A2));
> >                 D:=1-Sqr(F);
> >                 D1:=(Cos(E1)*Cos(A1)+F*Cos(E2)*Cos(A2))/D;
> >                 D2:=(Cos(E2)*Cos(A2)+F*Cos(E1)*Cos(A1))/D;
> >                 A:=B*(Sin(E1)+Sin(E2))*((D1*D2)/(D1+D2));

> Is that a joke? Hoe could anyone analyze that without the values of the
> variables.

> >C:=Abs((Cos(E2)*Sin(E1)*Sin(A2)-Cos(E1)*Sin(E2)*Sin(A1))/(A*Sqrt
> >(D)))*100*B;
> >                 {Geodesic}
> >                 Write(RocAltOutput,NarNum:7,A:11:2,C:9:2);
> >                 Average:=A;
> >                 {Vertical Midpoint}
> >                 D:=Sin(A1+A2);
> >                 H1:=B*(Sin(A2)*Sin(E1))/(D*Cos(E1));
> >                 H2:=B*(Sin(A1)*Sin(E2))/(D*Cos(E2));
> >                 A:=(H1+H2)/2;
> >                 C:=Abs((H1-H2)/(2*A))*100;
> >                 {Vertical Midpoint}
> >                 Average:=(Average+A)/2; {average becomes average of the
two
> >altitudes}
> >                 Writeln(RocAltOutput,A:17:2,C:9:2,Average:11:2);
> >               End;

> Osmo

Re:Division by zero during batch I/O


JRS:  In article <2uPg7.56$Nl3.167...@news.uswest.net>, seen in
news:comp.lang.pascal.borland, clink84 <clin...@yahoo.com> wrote at Wed,
22 Aug 2001 09:38:58 :-

Quote
>I am having a runtime division by zero error during batch I/O in TP7 for
>DOS.  Can anyone help?

First, get rid of that silly signature.

Second, read the mFAQ, and  <URL: http://www.merlyn.demon.co.uk/pas-
r200.htm>.  Either that, and the use of the fixes by PS & AB, will solve
your problem; or you will have to repost with details showing that you
have a different problem.

Try AB's fix first, being foolproof; but use PS's, installing with great
care to follow the instructions.

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 <URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
 <URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ;
 <URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.

Other Threads