You are here: Re: reducing decimals « PHP Programming Language « IT news, forums, messages
Re: reducing decimals

Posted by Michael Fesser on 08/18/07 15:32

..oO(albert)

>Doing a simple division, I obtain this number :
>0.0024096385542168672344587321276776492595672607421875
>I'd like to have 0.0024 instead.
>I know the number_format function but is it the right solution ?
>I thought of another solution :
>
>$MyDec = 0.0024096385542168672344587321276776492595672607421875;
>$MyDecOk = round($MyDec * 10000) / 10000 ; # => 0.0024
>
>Is there a special function to do so ?

Have a look at round()'s second parameter ...

Micha

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация