Re: rounding a number

From: Date: Mon, 24 Jun 2002 18:16:26 +0000
Subject: Re: rounding a number
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-103640@lists.php.net to get a copy of this message
seems to work fine for me. what are your results when you do this? mine are 0.4 and this is what is should be. if it were .349 it would round down. isn't this how it should work? What were your results? Jim Lucas ----- Original Message ----- From: "George Whiffen" <george@intellnet.net.uk> To: <php-general@lists.php.net>; <php-general@lists.php.net> Sent: Monday, June 24, 2002 2:36 AM Subject: Re: [PHP] rounding a number > Jason Wong wrote: > > > On Monday 24 June 2002 11:34, Phil Schwarzmann wrote: > > > I want to round a number to the nearest decimal place... > > > > > > if the number is 4.623, I want it to display 4.6 > > > if the number is 2.36, I want it to display 2.7 > > > > You don't really mean 2.36 --> 2.7 ?? > > > > > Is there a function that does this? round(), ceil(), floor() don't do > > > this and I've checked through all the math functions in my handy-dandy > > > "PHP Functions" reference book. > > > > round() seems to work. What's the problem you're having? > > > > It's worth noting that round doesn't always work e.g. > > try round(0.35,1).... > > > > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > That's no moon... > > -- Obi-wan Kenobi > > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#103640) next »