Bug #68837 [Fbk->Csd]: integer bcdiv randomly add traling 0
Edit report at https://bugs.php.net/bug.php?id=68837&edit=1
ID: 68837
User updated by: PhoneixSegovia at gmail dot com
Reported by: PhoneixSegovia at gmail dot com
Summary: integer bcdiv randomly add traling 0
-Status: Feedback
+Status: Closed
Type: Bug
Package: BC math related
Operating System: Ubuntu
PHP Version: 5.5.20
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I can't reproduce it now so I suppose it has been fixed.
Previous Comments:
------------------------------------------------------------------------
[2017-09-06 16:14:18] cmb@php.net
Please reply to pollita's questions. Otherwise we have to assume
that there is no bug.
------------------------------------------------------------------------
[2016-07-27 05:13:02] pollita@php.net
Is there *anywhere* in your code/config/webserver where you set bcmath.scale INI entry?
The extra zeros can result from a non-zero bcmath.scale, though the question then is "Why is
scale zero sometimes, then non-zero other times?" The problem *could* be a threading issue, so
I'd ask if you're using PHP in a threaded environment.
------------------------------------------------------------------------
[2015-01-15 12:51:05] PhoneixSegovia at gmail dot com
Description:
------------
When you do simple integer division with bcdiv some times the result have trailing 0 and other times
is a simply integer (without .000000).
For example with bcdiv('4163592965659328', 32) some times return
"130112280176854" but other times return "130112280176854.0000000000".
It appeared to be totally random as you refresh the page.
I have version 5.5.9. I have searched in the bugs but I didn't found any similar bug. Also I
know I must use the last version of php to report a bug but I can't do it (company limitation).
Note to use the hard refresh in the test script so the page isn't cached.
Test script:
---------------
<!DOCTYPE HTML>
<html>
<body>
<?php
echo bcdiv('4163592965659328', 32);
?>
</body>
</html>
Expected result:
----------------
130112280176854
Actual result:
--------------
130112280176854.0000000000
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68837&edit=1
Thread (4 messages)