From:             [EMAIL PROTECTED]
Operating system: Linux, *BSD, no clue about win32
PHP version:      4.0.4pl1
PHP Bug Type:     Math related
Bug description:  Odd behavior adding negative numbers.

Ok guys.. I've looked everywhere and cannot find an explanation
for this behavior.  Could you guys explain it? :)

This script returns the same thing on 4.0.4p1 and 4.0.3p1.

/* Anything less than 3.2/-0.32 exhibits this behavior.  Anything above it doesn't */
$x = 0.1 * 3.2;
$y = -0.32;
print("$x\t$y\n\n");

$a = $x - $y;
$b = $x + $y;

print("$a\t$b\n");

I can increase the 3.2 and the -0.32 and the return is sane.. everything I've tried 
below 3.2 returns this oddity.
Output from above script..
0.32    -0.32

0.64    5.5511151231258E-17

Any clues?


-- 
Edit Bug report at: http://bugs.php.net/?id=9292&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to