php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15026 bcpow error
Submitted: 2002-01-14 02:38 UTC Modified: 2003-02-25 02:00 UTC
From: kraljar at ipb dot cz Assigned:
Status: Closed Package: BC math related
PHP Version: 4.1.1 OS: WIN NT 4.0 SP6
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kraljar at ipb dot cz
New email:
PHP Version: OS:

 

 [2002-01-14 02:38 UTC] kraljar at ipb dot cz
Source code for demonstration:
<?
$a ="0.23568";
$b ="0.45689";
$c ="0.45689";
echo $a."...............a<BR>";
echo $b."...............b<BR>";
echo $c."...............b<BR>";
echo bccomp ($b, $c, 40)."...............bccomp($a, $c , 40)<BR>";
echo bcdiv ($a, $b , 40)."................bcdiv($a, $b , 40)<BR>";
echo bcmul ($a, $b , 40)."................bcmul($a, $b , 40)<BR>";
echo bcpow ($a, $b , 40)."................bcpow($a, $b , 40)<BR>";
echo pow ($a, $b )."................pow($a, $b )<BR>";
echo bcadd ($a, $b , 40)."................bcadd($a, $b , 40)<BR>";
echo bcsub ($a, $b , 40)."................bcsub($a, $b , 40)<BR>";
echo bcsqrt ($a, 40)."................bcsqrt($a, $b , 40)<BR>";

?>
Result:
0.23568...............a
0.45689...............b
0.45689...............b
0...............bccomp(0.23568, 0.45689 , 40)
0.5158353214121560988421720764297752194182................bcdiv(0.23568, 0.45689 , 40)
0.1076798352................bcmul(0.23568, 0.45689 , 40)
********* See here *****************************
1................bcpow(0.23568, 0.45689 , 40)
0.5166786686981................pow(0.23568, 0.45689 )
********* End of error *************************
0.6925700000000000000000000000000000000000................bcadd(0.23568, 0.45689 , 40)
-0.2212100000000000000000000000000000000000................bcsub(0.23568, 0.45689 , 40)
0.4854688455503607288095934026252222080687................bcsqrt(0.23568, 0.45689 , 40)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-03 06:37 UTC] sander@php.net
Dupe of 13551: PHP's BCmath implementation doesn't support decimal numbers.
 [2003-02-25 02:00 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Mar 22 23:01:25 2019 UTC