package jaci.openrio.toast.lib.math;

/**
 * A utility class to help with Math
 *
 * @author Jaci
 */
public class MathHelper {

    /**
     * Round a number (d) to the specified amount of decimal places (res)
     */
    public static double round(double d, int res) {
        int x = (int) Math.pow(10, res);
        return Math.rint(d * x) / x;
    }
}

@@ -31,16 +31,46 @@
 .math;%0A%0A
+import java.math.BigDecimal;%0A%0A
 /**%0A * A
@@ -306,76 +306,114 @@
     
-int x = (int) Math.pow(10, res);%0A        return Math.rint(d * x) / x
+BigDecimal bd = new BigDecimal(d).setScale(res, BigDecimal.ROUND_HALF_UP);%0A        return bd.doubleValue()
 ;%0A  

Rewrite MathHelper round function to use BigDecimal instead of multiply/divide rounding