I'm working on some "star rating" code and I really wanted to round numbers of to the nearest fraction. While the math is really basic, my math skills are rusty and this took me longer to solve than I care to admit. So I thought I'd just blog the solution for anyone else that might find it useful:
round( value/fraction ) * fraction
Like I said, it's very basic math but is very handy when you want to round to something other than to the closest integer.
Comments for this entry have been disabled.