Fix overflow for D(13) and above by replacing double with BigDecimal