class MathUtil extends AbstractCaller {

    @Description("Returns a <b>rounded</b> by <b>precision</b> and <b>direction</b> number<br/>" +
            "<b>value</b> - rounding value.<br/>" +
            "<b>direction = 0</b> - the value will be rounded down.<br/>" +
            "<b>direction = 1</b> - the value will be rounded up.<br/>" +
            "<b>direction = 2</b> - arithmetic rounding<br/>" +
            "<b>precision</b> - symbols of the value double are set to zero, starting from the position precision. Must be positive.<br/>" +
            "Example:<br/>" +
            "#{round_zero(12345,1,0)} returns 12340<br/>" +
            "#{round_zero(12345,1,1)} returns 12350<br/>" +
            "#{round_zero(12345,1,2)} returns 12350")
    @UtilityMethod
    public double roundZero(double value, int precision, int direction){

        switch (direction){
        case 0:return roundDown((long)value, (int)Math.pow(10, precision));
        case 1:return roundUp((long)value, (int)Math.pow(10, precision));
        case 2:return round((long)value, (int)Math.pow(10, precision));
        default:return round((long)value, (int)Math.pow(10, precision));
        }
    }

}