Re: [PHP] PHP has a bug...?

2004-04-06 Thread John W. Holmes
From: "Stephen Craton" <[EMAIL PROTECTED]>

> 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);

What version of PHP and what OS? I don't see this replicated on 4.3.3/Win2k.

---John Holmes...

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



[PHP] PHP has a bug...?

2004-04-05 Thread Stephen Craton
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