swarm-support
[Top][All Lists]
Advanced

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

Re: 3/4 = 0 ???


From: DARREN MATTHEW SCHREIBER
Subject: Re: 3/4 = 0 ???
Date: Wed, 21 Jul 1999 13:23:33 -0700 (PDT)

I sent this email before lunch.  In the middle of a nice stroll across
the sunny UCLA campus, I realized that the failure to recast the integer 
might have been the error.

So thanks to all for confirming my guess and showing me how to make the
change.  The recast works and now I only need to hunt down why I keep
getting the number of Neighbors as a zero value periodically...

        Darren


On Wed, 21 Jul 1999 address@hidden wrote:

> Hi,
> 
> I believe you need to cast numOthers and numNeighbors as floats or else
> the outcome of the division of ints will be an int. Try:
> 
>       fraction=(float)numOthers/(float)numNeighbors
> 
> instead.
> 
> Hope that helps,
> 
> Alan
> 
> > 
> >             if (numNeighbors != 0)
> >               fraction=(numOthers/numNeighbors);
> >             else
> >               fraction=100.0;  // This is a warning flag for division
> > by zero
> >
> 
> 
>                   ==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
> 
> 


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]