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

From: Date: Wed, 01 Apr 2020 15:44:09 +0000
Subject: Bug #79443 [Opn->Nab]: round with precision is not rounding
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226392@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: cmb@php.net Reported by: info at globules dot io Summary: round with precision is not rounding -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Windows 10 x64 PHP Version: 7.4.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. If you would like to know more about "floats" and what IEEE 754 is, read this: http://www.floating-point-gui.de/ Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2020-04-01 15:41:50] info at globules dot io Description: ------------ round with precision is not rounding Test script: --------------- echo round(-80.0035326999999938, 6); Expected result: ---------------- -80.003533 Actual result: -------------- -80.0035330000000044 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79443&edit=1

« previous php.bugs (#226392) next »