Addition, subtraction, multiplication and division, size comparison and precautions of BigDecimal in Java
preface
To borrow from the book effactive Java, the main design goal of float and double types is for scientific calculation and engineering calculation. They perform binary floating-point operations, which are carefully designed to provide more accurate and fast approximate calculations over a wide range of values. However, they do not provide completely accurate results, so they should not be used where accurate results are required. However, business calculations often require accurate results. In Java, the maximum value of int is 2147483647. Now what if you want to use a larger number? In other words, BigDecimal is used when the value is large. There are many introductions about BigDecimal. Friends who need to know can refer to this article: https://www.oudahe.com/p/41750/