bojanz / currency

Currency handling for Go.
https://pkg.go.dev/github.com/bojanz/currency
MIT License
533 stars 44 forks source link

The calculation precision (16) is sometimes not enough #11

Closed bojanz closed 3 years ago

bojanz commented 3 years ago

Problem discovered in https://github.com/bojanz/currency/pull/7, the RoundTo() tests are taken from there.

Still needs additional test coverage (in tests other than the one for RoundTo).

Went with a simpler/more performant way of selecting the precision, what do you think @Kunde21?

bojanz commented 3 years ago

The tests are now complete, we are ready to go.

bojanz commented 3 years ago

Let's proceed on our road to v1.0.0. It is still days away, so feel free to comment.

Kunde21 commented 3 years ago

I agree that it's an improvement, but any hard-coded values are susceptible to malicious inputs. Need to adjust to input if we're to be truly arbitrary precision.