Article View: ba.php
Article #97Re: Rounding
From: Brian Tkatch
Date: Tue, 07 Nov 2000 00:00
Date: Tue, 07 Nov 2000 00:00
24 lines
1337 bytes
1337 bytes
On Tue, 7 Nov 2000 18:36:26 -0000, "agent-blue" <agent_blue_17m@yahoo.co.uk> wrote: >I am writing a script that is dividing numbers > >as a result I can get a very long number as it contains many numbers after >the decimal point > >I know you can use floor() to drop everything after the decimal point and >ceil() to round 13.2 up to 14 >but how can I get > >2.8603515625 to be rounded to 2.86 ? > I believe the round function does just that with its second parameter. <URL:http://www.php.net/manual/function.round.php>. If you actually wanted to use floor or ceil then just move the decimal point with the power of ten. $Num = (Floor($Num * 100)/100) Brian
Technical Details
Message-ID:
<3a086633.629127312@news.alt.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8u9i3s$jq3$1@plutonium.btinternet.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10ce1c,8133919bc390d3b8 X-Google-Attributes: gid10ce1c,public X-Google-Thread: 108904,8133919bc390d3b8 X-Google-Attributes: gid108904,public X-Google-Thread: 10b1d3,8133919bc390d3b8 X-Google-Attributes: gid10b1d3,public From: SPAMBLOCK.Maxwell_Smart@ThePentagon.com.SPAMBLOCK (Brian Tkatch) Subject: Re: Rounding Date: 2000/11/07 Message-ID: <3a086633.629127312@news.alt.net> X-Deja-AN: 690929717 References: <8u9i3s$jq3$1@plutonium.btinternet.com> Organization: Altopia Corp. - Usenet Access - http://www.altopia.com Newsgroups: ba.php,mailing.www.php-user,ufra.lists.php