It is not a good solution, but you can add a small fraction to the number that will be rounded. Then, the floor function will return that number and ignore the small fraction.
Code:inline double round(double X, int k) { double tempDouble = X*pow(10.0,k) + 0.5 + 0.000000001; return ( floor(tempDouble) / pow(10.0,k) ); }