Re: Problem with number_format

From: Date: Tue, 25 May 2004 14:05:24 +0000
Subject: Re: Problem with number_format
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186890@lists.php.net to get a copy of this message
Hi there, Try using: round($number, 2); cheers, Gareth On 25 May 2004, at 16:00, fku@freemail.it wrote:
Hi, please suppose PHP 4.3.2 and $number=502,3550 number_format($number,2,'.',' ') returns 502.36. It seems ok, but if $number=253,0650 number_format($number,2,'.',' ') returns 253.06 instead of 253.07. Why? I've noticed this non-coherent approximation behaviour when 3rd decimal number is 5 and decimals are two many many times. It's a my error or should be a bug? Thanks, ciao Francesco ----------------------------------------------------------- Spazio ILLIMITATO per la tua Email, Scanner Antivirus, Antispam, Backup e POP3. Prova la nuova Email di superEva: http://webmail.supereva.it/ ----------------------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#186890) next »