PHP has a bug...?
| From: | Stephen Craton | Date: | Tue, 06 Apr 2004 01:25:43 +0000 |
| Subject: | PHP has a bug...? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182432@lists.php.net to get a copy of this message | ||
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