#15026 [Dup->Csd]: bcpow error
| From: | sniper@php.net | Date: | Tue, 25 Feb 2003 08:00:08 +0000 |
| Subject: | #15026 [Dup->Csd]: bcpow error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-34162@lists.php.net to get a copy of this message | ||
ID: 15026
Updated by: sniper@php.net
Reported By: kraljar at ipb dot cz
-Status: Duplicate
+Status: Closed
Bug Type: BC math related
Operating System: WIN NT 4.0 SP6
PHP Version: 4.1.1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2002-04-03 06:37:59] sander@php.net
Dupe of 13551: PHP's BCmath implementation doesn't support decimal
numbers.
------------------------------------------------------------------------
[2002-01-14 02:38:51] 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)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15026&edit=1