I was making a parabola grapher and I was testing out some values. Part of
the script is to take the variable b and multiply it was negative one, then
multiply by 2 times a. I entered a test value where a equals 1, b equals 0,
and c equals 0. The result told me that -1 times 0 is -0.

 

Here's the code I'm using:

 

$x = (-1 * $b) / (2 * $a);

                        if($x == -0) {

                                    $x = 0;

                        }

 

I've fixed it for now by putting the if statement, but I'm not sure why it's
giving me -0.

 

Thanks,

Stephen Craton

http://www.melchior.us

 

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to