Suppose I have a function double toDecimal(int numerator, int denominator, int places);
How would I write it so that I get the decimal value to the fixed number of places asked for?
return Math.round((double) numerator * Math.pow(10, places)) /
(denominator * Math.pow(10, places));
I tried this but on testing even when I add decimals with more places the tests passed when they shouldn't be.