Bug #16511 Updated: wrong division: 18/21=0.857142857142861

From: Date: Tue, 09 Apr 2002 13:44:52 +0000
Subject: Bug #16511 Updated: wrong division: 18/21=0.857142857142861
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-4432@lists.php.net to get a copy of this message
ID: 16511 Updated by: imajes@php.net Reported By: sutter@ecology.at Status: Bogus Bug Type: Variables related Operating System: linux 2.2.12, apache 1.3.23 PHP Version: 4.1.2 New Comment: dudes, 18/21 is EXACTLY 0.857142857142861 EOF. Previous Comments: ------------------------------------------------------------------------ [2002-04-09 09:43:54] imajes@php.net which planet do you come from? ------------------------------------------------------------------------ [2002-04-09 09:43:45] derick@php.net 0.86 * 21 = 18.06 I suggest you buy another calculater. Derick ------------------------------------------------------------------------ [2002-04-09 09:38:54] sutter@ecology.at thanks for your comments; using number_format(),round() or printf rounds the number. but I do not really want a rounded number; and 18/21 is exactly 0.86. philipp ------------------------------------------------------------------------ [2002-04-09 08:20:54] imajes@php.net the really amusing thing is that THIS IS RIGHT. if you want it to give you a rounded figure, this code will help you: <?php printf("%0.2f", 18/21); ?> ------------------------------------------------------------------------ [2002-04-09 08:08:10] derick@php.net erm 18/21 = 0.857142857142861. If you just want 0.86, use number_format() or round() not a bug, Bogus ------------------------------------------------------------------------ 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 http://bugs.php.net/16511 -- Edit this bug report at http://bugs.php.net/?id=16511&edit=1

« previous php.bugs (#4432) next »