src/main/java/com/xdavide9/calculatorfx/CalculatorFXController.java
private BigDecimal division(BigDecimal a, BigDecimal b) {
        a = a.setScale(15, RoundingMode.HALF_UP);
        a = a.divide(b, RoundingMode.HALF_UP);
        if (a.toString().contains("."))
            a = round(a);
        //dividing 0 by something is a special case that keeps the scale of 15 because
        //it does not contain a point so round is not run on it
        if (a.toString().contains("E") && a.toString().contains("0"))
            a = new BigDecimal("0");
        log.info("Result = {}", a);
        return a;
    }
/**
     * Updates a with the quotient of a and b.
     * @return a
     */
Updates a with the quotient of a and b.
@return a
Updates a with the quotient of a and b . @return a
private BigDecimal division(BigDecimal a, BigDecimal b) {
        a = a.setScale(15, RoundingMode.HALF_UP);
        a = a.divide(b, RoundingMode.HALF_UP);
        if (a.toString().contains("."))
            a = round(a);
        if (a.toString().contains("E") && a.toString().contains("0"))
            a = new BigDecimal("0");
        log.info("Result = {}", a);
        return a;
    }
private BigDecimal division ( BigDecimal a , BigDecimal b ) { a = a . setScale ( 15 , RoundingMode . HALF_UP ) ; a = a . divide ( b , RoundingMode . HALF_UP ) ; if ( a . toString ( ) . contains ( "." ) ) a = round ( a ) ; if ( a . toString ( ) . contains ( "E" ) && a . toString ( ) . contains ( "0" ) ) a = new BigDecimal ( "0" ) ; log . info ( "Result = {}" , a ) ; return a ; }
Updates a with the quotient of a and b.
Updates a with the quotient of a and b .
//dividing 0 by something is a special case that keeps the scale of 15 because //it does not contain a point so round is not run on it