decimal icon indicating copy to clipboard operation
decimal copied to clipboard

decimal.Pow result fail

Open bendh1 opened this issue 3 years ago • 2 comments

input: fmt.Println(math.Pow(0.0208333333333333, 0.33)) fmt.Println(decimal.NewFromFloat(0.0208333333333333).Pow(decimal.NewFromFloat(0.33)))

ouput: 0.2787342852450195 1

can you help me?

bendh1 avatar Sep 08 '21 10:09 bendh1

Hi @bendh1! Unfortunately Pow method is only working with Integer exponents right now. This is ongoing issue that must be fixed and we are aware of that. First PR that address this issue have been created some time ago by my #229, but I don't have enough time to polish it and merge to main branch :< Sorry for any inconvenience.

mwoss avatar Sep 08 '21 11:09 mwoss

I've finally implemented an improved Pow method. Please take a look at this comment: https://github.com/shopspring/decimal/issues/55#issuecomment-2033204145

mwoss avatar Apr 02 '24 22:04 mwoss