schowdhuri / round-half-even

Banker's rounding utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not consider numDecimals = 0

leohgbs opened this issue · comments

commented

@leohgbs Do you see an error when you set numDecimals to 0? Feel free to play around with the demo.

roundHalfEven(255.552,0)
demo: 255
answer: 256

my solution

 if (numDecimals === 0) {
        return roundHalfEven(value/10, 1)*10
 }
commented
roundHalfEven(255.552,0)
demo: 255
answer: 256

my solution

 if (numDecimals === 0) {
        return roundHalfEven(value/10, 1)*10
 }

@leohgbs Thanks for catching that! Love your fix! Do you wanna send a PR?

commented

Fixed in v1.2.1