Compare that BigDecimal value and double value are equal to two decimal places

Viewed 7504

I'm working with an API that returns a double value. I need to compare that value to a BigDecimal value for equality to two decimal places.

Should I convert BigDecimal to double and then compare

Math.abs(myBigDecimal.doubleValue() - apiDouble) >= .01

Or are there issues with this approach? Perhaps I should convert the double into a BigDecimal and and then compare?

2 Answers
Related