double my_round(double val, int digit){ return ((long)(val * pow(10, digit) + 0.5)) / pow(10, digit) ; }