right now, i am using this function to round double/float numbers:

PHP Code:
int round(double num)
{
    return 
num 0.5f;

how could i get it so it would take another paramater, that would round it to a specific decimal place? and, is this a good way to accomplish this function?