|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79866 yaml_emit looses decimals on floats/doubles
Submitted: 2020-07-16 11:23 UTC Modified: 2020-08-16 03:52 UTC
From: gaaf at gmx dot net Assigned: bd808 (profile)
Status: Closed Package: yaml (PECL)
PHP Version: 7.4.8 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gaaf at gmx dot net
New email:
PHP Version: OS:


 [2020-07-16 11:23 UTC] gaaf at gmx dot net
yaml_emit will limit the number of decimals to 6, a that is the default precision for snprintf used by the module to convert the double to a string.

I would expect the resulting yaml to contain the exact same number as "echo" would print.

Test script:

$i = 0.123456789;

echo $i;
// 0.123456789

echo yaml_emit($i);
// --- 0.123457
// ...

Expected result:
--- 0.123456789

Actual result:
--- 0.123457


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-16 03:52 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: bd808
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 28 10:03:44 2023 UTC