Bug #79443 [Nab]: round with precision is not rounding

From: Date: Wed, 01 Apr 2020 18:09:01 +0000
Subject: Bug #79443 [Nab]: round with precision is not rounding
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226404@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79443&edit=1 ID: 79443 Updated by: nikic@php.net Reported by: info at globules dot io Summary: round with precision is not rounding Status: Not a bug Type: Bug Package: *General Issues Operating System: Windows 10 x64 PHP Version: 7.4.4 Assigned To: cmb Block user comment: N Private report: N New Comment: @info at globules dot io: Set precision=-1 to display the value with full accuracy but without unnecessary digits. For fine-grained control use sprintf(). Previous Comments: ------------------------------------------------------------------------ [2020-04-01 18:04:56] info at globules dot io Any workaround/idea welcome. Some values cannot be stored as string and need to be trimmed (8 decimals max). Those are not the scientific values that require high precision. ------------------------------------------------------------------------ [2020-04-01 17:53:56] info at globules dot io tiffany, we actually need a greater precision for scientific calculations. The Linux box is in fact the one that is not properly configured. The issue arises when some other values that are not scientific need to be rounded and validated before storage, and this values can't exceed 8 decimals. But round doesn't supersede the precision, which creates the issue. ------------------------------------------------------------------------ [2020-04-01 17:32:56] tiffany@php.net If it's any help at all, the most I've changed in my php.ini file is adding the file path for logging, otherwise everything has been left default. Maybe do a diff with a default php.ini file against your current php.ini file. ------------------------------------------------------------------------ [2020-04-01 17:02:09] info at globules dot io Oh I see, our precision on the win box in the php.ini is different... I guess that's the difference we see. Not sure how to fix it now but thanks. ------------------------------------------------------------------------ [2020-04-01 16:57:26] cmb@php.net Also note that round() returns a float. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=79443 -- Edit this bug report at https://bugs.php.net/bug.php?id=79443&edit=1

« previous php.bugs (#226404) next »