Re: Re: Problem with number_format

From: Date: Tue, 25 May 2004 16:47:22 +0000
Subject: Re: Re: Problem with number_format
Groups: php.general 
Request: Send a blank email to php-general+get-186917@lists.php.net to get a copy of this message
>Martin Geisler wrote: > >> My PHP manual (from a Debian package) has the following note on the > page for >round(): >> > Caution >> >> When rounding on exact halves round() rounds down on evens and up on >> odds. If you want to always force it in one direction on a .5 (or >> .05 in your case) add or substract a tiny fuzz factor. >> > >I'm surprised with this note on manuals. I do not know in other places, but in >the European Union there are laws and directives that obligates >to always round to 5/4 in currency operations (Specially on Euro >Conversions). It means that 5 and above rounds always up, anything >bellow 5 rounds always down. So, 0,655 must round to 0,66 and 0,654 must >round to 0,65. In this case, nothing to do: It is the law. So it seems a PHP4 bug, now corrected in PHP5-RC. Waiting for a stable release of PHP5, it seems I need to add a "tiny fuzz factor" where 3rd decimal is 5. I'm working on Euro conversions, this isn't a good new...:( 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/ -----------------------------------------------------------

« previous php.general (#186917) next »