php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32320 Problem with negative exponent handling
Submitted: 2005-03-15 19:08 UTC Modified: 2005-03-25 01:48 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: blucasco at gmail dot com Assigned:
Status: No Feedback Package: Output Control
PHP Version: 5.0.3 OS: FC3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-03-15 19:08 UTC] blucasco at gmail dot com
Description:
------------
PHP 5.03 appears to handle math equations with negative exponents differently than PHP 4.3.x.  I am trying to use the following example in a larger script, but the primary difference is included below. 

Reproduce code:
---------------
PHP 4.3:
<? echo (-4738698913^43814); ?>
outputs:
-443704711

PHP 5.03:
<? echo (-4738698913^43814); ?>
outputs:
-2147439834

Expected result:
----------------
I believe 5.03 should output what 4.3 does, but this is an extraordinarily large number so I can't say for certain.  

PHP 4.3:
<? echo (-4738698913^43814); ?>
outputs:
-443704711

Actual result:
--------------
PHP 5.03:
<? echo (-4738698913^43814); ?>
outputs:
-2147439834

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-16 07:48 UTC] sniper@php.net
Can you explain why I get exactly same results with both PHP 4 and 5 ?

 [2005-03-16 16:56 UTC] blucasco at gmail dot com
I think that's a good thing (tm) if it outputs correctly for you -- perhaps it was some element of the build on FC3.   

But I must caution (before my bug gets immediately discounted), the incorrect results in 5.0.3 listed here were the exact same on two different machines with different processors (AMD vs Intel) with a source build of PHP 5.0.3, running FC3.

Glibtools, gcc, c++, binutils were all slightly different versions on both machines to minimize the chance that it was a anamoly with one of those builds.

I rebuilt a machine with SuSE and will post results of same test here.  But, it would be beneficial if someone with FC3 can address whether this actually happens on their machine.
 [2005-03-18 19:27 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

I have FC3, so..

 [2005-03-25 01:48 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC