package com.oguerreiro.resilient.expression;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * Base math functions
 */
public class MathExpressionFunctions extends BaseExpressionFunctions {

  public BigDecimal round(BigDecimal value, Integer precision) {
    if (value == null) {
      return null;
    }

    BigDecimal rounded = value.setScale(3, RoundingMode.HALF_UP);

    return rounded;
  }

}
