Doc #66745 [Opn]: Scientific notation
| From: | aharvey@php.net | Date: | Thu, 03 Jul 2014 17:46:13 +0000 |
| Subject: | Doc #66745 [Opn]: Scientific notation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11331@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: aharvey@php.net
Reported by: eric dot vercherat at gmail dot com
Summary: Scientific notation
Status: Open
Type: Documentation Problem
Package: BC math related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
A pull request would be welcome, I'm sure.
Previous Comments:
------------------------------------------------------------------------
[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