#31870 [Opn->Bgs]: rounding negative numbers gives "-0"

From: Date: Mon, 07 Feb 2005 12:41:33 +0000
Subject: #31870 [Opn->Bgs]: rounding negative numbers gives "-0"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73594@lists.php.net to get a copy of this message
ID: 31870 Updated by: derick@php.net Reported By: amir at foresthc dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Debian woody PHP Version: 5.0.3 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. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2005-02-07 13:08:49] amir at foresthc dot com Description: ------------ When rounding real negative numbers that should round to zero, the result is -0 (minus zero). This isn't a critical bug, but it's a nusanse hunting these down in places were the output reaches the user. Reproduce code: --------------- echo round(-0.1); Expected result: ---------------- 0 Actual result: -------------- -0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31870&edit=1

« previous php.bugs (#73594) next »