Expressions with BigDecimal Java / Kotlin

I need help from those who understand Java / Kotlin.

I would like to perform some calculations with BigDecimal

How would the expression below look using BigDecimal?

(1 + 0.02) ^ (1 / 251) - 1

I tried to do like this:

val x = (BigDecimal.ONE + BigDecimal(0.02)).pow(1/251) - 1

However, dividing 1 by 251 is not accurate and this expression always returns 0



from Recent Questions - Stack Overflow https://ift.tt/2M3T7Qu
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept