Hi there,

Try using:

round($number, 2);

cheers,

Gareth

On 25 May 2004, at 16:00, [EMAIL PROTECTED] 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


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to