php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26366 Arithmetic Error with JS and PHP
Submitted: 2003-11-23 14:32 UTC Modified: 2003-11-23 14:59 UTC
From: JaiKMw at aol dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.4 OS: WinME
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: JaiKMw at aol dot com
New email:
PHP Version: OS:

 

 [2003-11-23 14:32 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-23 14:44 UTC] 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:59 UTC] JaiKMw at aol dot com
: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...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 04:01:38 2025 UTC