Get the latest tech news

What's the Point? BigDecimal in review


More to the point: Where’s the point? Recently I had to dig into the BigDecimal implementation to fix a reported bug. Every time I have to look at the BigDecimal code, it is a journey of rediscovery. I’m going to write down a few things to save me some time in the future.

round-half-up If the discarded digits represent greater than or equal to half (0.5) of the value of a one in the next left position then the result coefficient should be incremented by 1 (rounded up). While writing this post, I found a few things hard to explain/justify and ended up making some code tweaks that got rid of an allocation and simplified a recursive call. So I looked around at some implementations of BigInteger packages, decided on what I wanted to provide – I needed to support at least the basic methods available in the Java version – and started coding.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of review

review

Photo of point

point

Photo of BigDecimal

BigDecimal

Related news:

News photo

Nobody Wants to Die review - a noiry cyberpunk tale told beautifully

News photo

CMF Phone 1 review: The only good $200 phone I've ever used

News photo

Samsung Galaxy Watch 7 review: Just needs a pinch of pizazz