Doc #66745 [Opn->Csd]: Scientific notation
| From: | cmb@php.net | Date: | Thu, 07 Sep 2017 22:24:00 +0000 |
| Subject: | Doc #66745 [Opn->Csd]: Scientific notation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14958@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66745&edit=1
ID: 66745
Updated by: cmb@php.net
Reported by: eric dot vercherat at gmail dot com
Summary: Scientific notation
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: BC math related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-09-07 22:23:29] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=343020
Log: Fix bug #66745: Scientific notation
We document that float to string is problematic for BCMath.
------------------------------------------------------------------------
[2016-07-13 23:55:47] cmb@php.net
Related to bug #66959.
------------------------------------------------------------------------
[2014-07-03 17:46:13] aharvey@php.net
A pull request would be welcome, I'm sure.
------------------------------------------------------------------------
[2014-07-03 16:41:36] tycoonmaster at gmail dot com
I do not know if this is intentional or merely an oversight but I encounter this problem,
constantly, every day. So far the easiest solution has been to format the string:
$number = number_format($number, 8, '.', '');
prior to passing it into BC functions.
Are there any patches/fixes for this in the future?
Or will I and so many others, need to constantly work around this issue?
Example: http://www.php.net/manual/en/ref.bc.php#92888
------------------------------------------------------------------------
[2014-02-20 08:32:55] eric dot vercherat at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/ref.bc
---
It's not mentioned in the documentation that BC Math doesn't support scientific notation.
Please make something about it.
Test script:
---------------
$a = '1' ;
$b = '0.00000001';
$result = bcdiv($a, $b);
var_dump($result);
$a = '1' ;
$b = '1e-8';
$result = bcdiv($a, $b);
var_dump($result);
Expected result:
----------------
string(40) "100000000.000000000000000000000000000000"
Actual result:
--------------
Warning: bcdiv() [function.bcdiv]: Division by zero in C:\wamp\www\utilitaires\test_bcdiv.php on
line 17
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66745&edit=1