Why is BigDecimal.equals specified to compare both value and scale individually?

Because in some situations, an indication of precision (i.e. the margin of error) may be important.

For example, if you’re storing measurements made by two physical sensors, perhaps one is 10x more precise than the other. It may be important to represent this fact.

Leave a Comment

tech