Bug #70316 [Fbk]: round function bug

From: Date: Fri, 21 Aug 2015 08:04:15 +0000
Subject: Bug #70316 [Fbk]: round function bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195387@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70316&edit=1 ID: 70316 Updated by: yohgaki@php.net Reported by: 277460173 at qq dot com Summary: round function bug Status: Feedback Type: Bug Package: *General Issues Operating System: linux nginx PHP/5.4.41 PHP Version: 5.4Git-2015-08-21 (Git) Block user comment: N Private report: N New Comment: s/export()/var_export()/ Previous Comments: ------------------------------------------------------------------------ [2015-08-21 08:03:11] yohgaki@php.net This isn't a bug, but a spec that dumps internal data directly. Anyway, I'm preparing patch that actually rounds float when precision=-1. export() rounds value to the nearest. What should we do for dump? ------------------------------------------------------------------------ [2015-08-21 07:18:46] laruence@php.net what's the "dump" function's definition ? ------------------------------------------------------------------------ [2015-08-21 05:32:02] 277460173 at qq dot com Description: ------------ $source=1370.72; $local=1238.265; $aa=($source - $local) / $source; dump($aa); $bb= round($aa,4); dump($bb); dump(phpversion()); result: float(0.09663169721022523) float(0.09660000000000001) string(6) "5.4.41" Test script: --------------- $source=1370.72; $local=1238.265; $aa=($source - $local) / $source; dump($aa); $bb= round($aa,4); dump($bb); dump(phpversion()); Expected result: ---------------- float(0.09663169721022523) float(0.0966) string(6) "5.4.41" Actual result: -------------- float(0.09663169721022523) float(0.09660000000000001) string(6) "5.4.41" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70316&edit=1

« previous php.bugs (#195387) next »