scale « bigdecimal « Java Data Type Q&A

1. AlmostEqual2sComplement or BigDecimal Scaling

Using Java: The more I read on floating point value comparison, the more I get lost. In case of currency which is usually gets rounded off, what whoule you prefer..using Epsilon or ...

2. Scale() of Divide method in BigDecimal

new BigDecimal("37146555.53880000").divide(new BigDecimal("1000000")).scale()
This returns 10. But according to the API, the divide method:
Returns a BigDecimal whose value is (this / divisor), and whose preferred scale is (this.scale() ...

4. Determine number of decimal places? - BigDecimal.scale() doesn't make sense

I have tried something like double aDouble String str = Double.valueOf(aDouble).toString(); str = str.substring(w1Str.indexOf(".") + 1); if(str.length() > 4) //throw error This approach works fine as long as the Double.toString() doesn't return a number in scientific notation. I've looked and haven't found a very good solution so far, so any suggestions would be welcome. I've tried to use BigDecimal.scale() to determine ...

5. BigDecimal scale question