[PHP] Re: Rounding down?

2009-08-22 Thread David Robley
Ron Piggott wrote: > Is there a way to round down to the nearest 50? > > Example: Any number between 400 and 449 I would 400 to be displayed; 450 > to 499 would be 450; 500 to 549 would be 500, etc? > > The original number of subscribers is from a mySQL query and changes each > day. I am trying

[PHP] Re: rounding a number

2002-06-24 Thread George Whiffen
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 > > Is there a function that does this? round(), ceil(), floor() don't do > this and I've checked through all

[PHP] Re: Rounding....Message repeated

2002-06-21 Thread George Whiffen
> Repeat of previous message in thread without the extra ugly wrapping, (sorry!!!) Matthew Clark wrote: Seeing as the mathematically correct way to round numbers is to round down to n for n-1<=m<=n.5 and up to n+1 for n.5= 0.0) return_val = floor(pow(10.0,places - DBL_DIG)) + 0.5 + re

[PHP] Re: Rounding....

2002-06-21 Thread George Whiffen
Matthew Clark wrote: > Seeing as the mathematically correct way to round numbers is to round down > to n for n-1<=m<=n.5 and up to n+1 for n.5 round() function couldn't include a little 'fuzz' to handle the rounding > problems we encounter due to floating point representation in the hardware? >