Project - Cash Register doesn't pass

Hallo to all of you.

I’m trying to solve the project “Cash Register”, but it doesn’t pas.

The following test:

`checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])`
should return
`{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}`

my function returns

{ status: 'OPEN',
  change: 
   [ [ 'TWENTY', 60 ],
     [ 'TEN', 20 ],
     [ 'FIVE', 15 ],
     [ 'ONE', 1 ],
     [ 'QUARTER', 0.5 ],
     [ 'DIME', 0.2 ],
     [ 'PENNY', 0.03 ] ] }

The difference is only 1 cent!

The test

checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
should return
{status: "INSUFFICIENT_FUNDS", change: []}

returns as not passed but my function return

{ status: 'OPEN',
change: 
   [ [ 'QUARTER', 0 ],
     [ 'DIME', 0 ],
     [ 'NICKEL', 0 ],
     [ 'PENNY', 0.01 ] ] }

Again the difference of 1 cent.

It seem to that there’s a problem with floating point math, but I cannot find it.

You should not use floating point numbers in this problem. I would instead use an integer number of cents.