|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49947 Looks like overlow
Submitted: 2009-10-21 17:29 UTC Modified: 2009-10-21 20:39 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: haochen at pristineprinting dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2.11 OS: CentOS 5.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: haochen at pristineprinting dot com
New email:
PHP Version: OS:


 [2009-10-21 17:29 UTC] haochen at pristineprinting dot com
It looks like overflow when I do plus 1. But when I do tims 2, it looks correct. Strange! I guess times and division move left or right for binery number(...1011101...). Plus and minus functions maybe have bugs? I don't know my code is wrong or it is a bug.

Server is Centos 5.3+PHP 5.2.11+Apache = Web Server
I just put this code into public_html

And client is WinXP+SP3+IE7. IE open the php. Wrong result.

Thanks a lot.

Reproduce code:
echo "pow($x,$p)   = $a <br><br>";
echo "pow($x,$p)+2 = $r <br><br>";
echo "pow($x,$p)*2 = $rr <br><br>";

Expected result:
pow(2,100)   = 1,267,650,600,228,229,401,496,703,205,376 

pow(2,100)+2 = 1,267,650,600,228,229,401,496,703,205,378 

pow(2,100)*2 = 2,535,301,200,456,458,802,993,406,410,752 

Actual result:
pow(2,100)   = 1,267,650,600,228,229,401,496,703,205,376 

pow(2,100)+2 = 1,267,650,600,228,229,401,496,703,205,376 

pow(2,100)*2 = 2,535,301,200,456,458,802,993,406,410,752 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-21 18:09 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

pow(2,100)+2  will be converted to a float, and floats aren't precise.
 [2009-10-21 18:59 UTC] haochen at pristineprinting dot com
Thanks for your quick response.

You are right. I tested in Java and ASP, they lost more precise than PHP.

Do you think it is 32-bit system limition or current-generation computer limition?

If my server is AIX, the result will be correct or not?

Anyway, thanks for your answer again. :-)
 [2009-10-21 20:39 UTC]
All "recent" machines should follow the IEEE 754 standard, but I know nothing about AIX.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 08:01:29 2023 UTC