Reply to Re: float reduced

Your name:

Reply:


Posted by Hero Wanders on 08/28/05 02:24

Hello!


>>I'd like to write a function who return a float with only two digits
>>after the point.
>>
>>For instance : 12.34567 -> 12.34
>>
>
> http://www.php.net/round

That *rounds* the value instead of returning the float with only the
last to digits of it (ok actually Thierry asked for a function which
returns *a* float (function give($float) { return 3.14; } would do it)).

I think

function cutFloat($float)
{
return (float) floor($float*100)/100;
}

is what Thierry really searches.

Greetings,
Hero Wanders

[Back to original 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

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