Thread
:
How can i round a number to the nearest 300?
View Single Post
Aug 10th, 2004, 11:16 PM
#
5
kurifu
Expert Programmer
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power:
5
Another way to do this, though less efficient.
(pseudo coded of course)
$an_integer= (int) $your_num / 300;
$new_val = $an_integer * 300; //this floors to nearest 300
if(( $your_num - $new_val ) >= 150 ) $new_val += 300;
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting:
http://www.crd-hosting.com
Consulting:
http://www.crdev-consulting.com
kurifu
View Public Profile
Visit kurifu's homepage!
Find More Posts by kurifu