src/main/java/com/xdavide9/calculatorfx/CalculatorFXController.java
private BigDecimal stripDecimalTrailingZeros(BigDecimal d) {
        d = d.stripTrailingZeros();
        if (d.scale() < 0)
            d = d.setScale(0, RoundingMode.HALF_UP);
        return d;
    }
/**
     * BigDecimal.stripTrailingZeros removes not only the 0s that are decimal
     * but also the 0s in the integer part of the number.
     * For example: 100 would be 1e+2 where the scale is negative.
     * To avoid this set the scale 0 so no scientific notation happens.
     */
BigDecimal.stripTrailingZeros removes not only the 0s that are decimal
but also the 0s in the integer part of the number.
For example: 100 would be 1e+2 where the scale is negative.
To avoid this set the scale 0 so no scientific notation happens.
BigDecimal . stripTrailingZeros removes not only the 0s that are decimal but also the 0s in the integer part of the number . For example : 100 would be 1e + 2 where the scale is negative . To avoid this set the scale 0 so no scientific notation happens .
private BigDecimal stripDecimalTrailingZeros(BigDecimal d) {
        d = d.stripTrailingZeros();
        if (d.scale() < 0)
            d = d.setScale(0, RoundingMode.HALF_UP);
        return d;
    }
private BigDecimal stripDecimalTrailingZeros ( BigDecimal d ) { d = d . stripTrailingZeros ( ) ; if ( d . scale ( ) < 0 ) d = d . setScale ( 0 , RoundingMode . HALF_UP ) ; return d ; }
BigDecimal.stripTrailingZeros removes not only the 0s that are decimal
 but also the 0s in the integer part of the number.
BigDecimal . stripTrailingZeros removes not only the 0s that are decimal but also the 0s in the integer part of the number .