Re: A89: Divide by Zero problem


[Prev][Next][Index][Thread]

Re: A89: Divide by Zero problem




That did the trick, thanx.  I'm working on porting a program I wrote in
BASIC over to C, and the formula seemed to work fine in BASIC.

----- Original Message -----
From: "Nathaniel Gibson" <ngibson@mail.ptd.net>
To: <assembly-89@lists.ticalc.org>
Sent: Thursday, June 29, 2000 9:53 PM
Subject: Re: A89: Divide by Zero problem


>
> >I'm working a program with TIGCC that generates up a list by using a
random
> >number but when I try to use the an equation like this:
> >
> >(random(99) +  1) / (14 / 100)
> >
> >I get an error message (from TEOS) saying Divide by zero.  What's up with
> >this?
>
> Truncation error. 14 / 100 = 0 in integer math. Try:
>
> 100 * (random(99)+1) / 14
>
> since, in reality, when dividing by a number less than one, you're
> really multiplying by it's inverse.
>
>
> Nathaniel Gibson
> SiCoDe Software
> ngibson@ptd.net
>
>
> http://sicode.ticalc.org
>




References: