|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66745 Scientific notation
Submitted: 2014-02-20 08:32 UTC Modified: 2017-09-07 22:24 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: eric dot vercherat at gmail dot com Assigned: cmb (profile)
Status: Closed Package: BC math related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2014-02-20 08:32 UTC] eric dot vercherat at gmail dot com
From manual page:

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);

$a =  '1' ;
$b =  '1e-8';

$result = bcdiv($a, $b);

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-03 16:41 UTC] 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?

 [2014-07-03 17:46 UTC]
A pull request would be welcome, I'm sure.
 [2016-07-13 23:55 UTC]
Related to bug #66959.
 [2017-09-07 22:23 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix bug #66745: Scientific notation

We document that float to string is problematic for BCMath.
 [2017-09-07 22:24 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-02-07 06:06 UTC]
Automatic comment on behalf of cmb
Log: Fix bug #66745: Scientific notation
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 06:01:29 2024 UTC