ID:               35656
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at lipfi dot ch
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Gentoo Linux 2005.1
 PHP Version:      5.1.1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------

[2005-12-13 11:00:33] php at lipfi dot ch

Description:
------------
When multiplying two float values, one being 0, one being negative,
it's possible to either get 0 or -0 (!) as a result depending on the
operands order.

This is IMHO not how math is supposed to work.

Additionally, I'm seing discrepancies between the variables value and
what var_dump() things it contains. The problem is very simple to
reproduce

Reproduce code:
---------------
<?php
  $v = 0*-0.02;
  var_dump($v);
  echo "$v\n";
  $v = floatval($v);
  echo "$v\n\n";

  $v = -0.02*0;
  var_dump($v);
  echo "$v\n";
?>

Expected result:
----------------
float(0)
0
0

float(0)
0

Actual result:
--------------
float(0)
-0
-0

float(0)
0

(the -0 obviously being the problem here)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35656&edit=1

Reply via email to