swarm-support
[Top][All Lists]
Advanced

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

Re: 3/4 = 0 ???


From: surak
Subject: Re: 3/4 = 0 ???
Date: Wed, 21 Jul 1999 14:28:24 -0500 (CDT)

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.



reply via email to

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