Use java.math.BigDecimal to compute rational and float value.