#26366 [Bgs]: Arithmetic Error with JS and PHP
| From: | JaiKMw at aol dot com | Date: | Sun, 23 Nov 2003 19:59:56 +0000 |
| Subject: | #26366 [Bgs]: Arithmetic Error with JS and PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-50878@lists.php.net to get a copy of this message | ||
ID: 26366
User updated by: JaiKMw at aol dot com
Reported By: JaiKMw at aol dot com
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: WinME
PHP Version: 4.3.4
New Comment:
:O, SOrry.. hahahaha, LOL LOL, that's right, sorry it's only that i've
been sitted in this pc for about 12 hrs xD..., Sorry, for wasting oyur
time bro. :D, next time i'll be more "inteligent".. LOL :D...
Previous Comments:
------------------------------------------------------------------------
[2003-11-23 14:44:33] derick@php.net
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
Nothing stupid here except your knowledge of operator preference.
23+23*0.5 == 23 + (23 * 0.5) = 34.5
------------------------------------------------------------------------
[2003-11-23 14:32:53] JaiKMw at aol dot com
Description:
------------
/* I would like to know if this
is a bug, cuz i konw of some
issues of defective processors
like my pentium II processor
I don't think that, cuz in
the calculator of WinME the
Answer is Right (23+23/2=23)
This also happens with JavaScript... :-| :D
Reproduce code:
---------------
<?php
function Mm($a,$b){
$R=$a+$b*0.5;// Is The Same If I Put " /2 " Instead.
return $R;
}
echo Mm(23,23)."<BR>";//The Correct Would Be 23 Instead of 34.5
echo
Mm(243,456)."<BR>";//''''''''''''''''''
349.5 Instead of 471.
?>
Expected result:
----------------
To write the Correct Answers..
Actual result:
--------------
Doesn't givethe right Answer, and, it seems so stupid :D.. with all the
respect :P, cuz 23+23=46, but, javascript do the same too, is an error
on my processor or not?, the calc.exe shows the right answer.. :D...
That bugs are from year 2000 xD.. :D
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26366&edit=1