bojanz / currency

Currency handling for Go.

Home Page:https://pkg.go.dev/github.com/bojanz/currency

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support banker's rounding

josharian opened this issue · comments

I'd like to add banker's rounding as a rounding option. apd supports it (RoundHalfEven), so it is a relatively trivial change, but it does mean adding new API.

WDYT?

Sure, no reason not to.

Will you be using banker's rounding in your own project? I'd love to hear how/why. I didn't add the constant because I'd never seen it used in the wild, the eCommerce projects I consulted on always rounded either half_up or half_down.

The why is kind of boring--longstanding habit plus avoidance of systematic bias.

I'll send a PR or two sometime over the coming weeks.