Weird problem on the last algorithm project

I got an unfixed number as a result (the 50cent change) every time i try to compile with the last argument as you can see in the image i attached.

Here’s my code:

function checkCashRegister(price, cash, cid) {

const newObj = { status: “INSUFFICIENT_FUNDS”, change: };

const newArr = ;

const coins = [0.01, 0.05, 0.1, 0.25, 1, 5, 10, 20, 100];

let change = cash - price;

while (change > 0) {

for (let i = cid.length - 1; i >= 0; i--) {

  while (change - coins[i] >= 0 && cid[i]?.[1]) {

    if (newArr.every((el) => el[0] != cid[i][0])) {

      newArr.push([cid[i][0].toString(), 0]);

    }

    change = change.toFixed(2) - coins[i].toFixed(2);

    cid[i][1] = cid[i][1].toFixed(2) - coins[i].toFixed(2);

    newArr[newArr.length - 1][1] = newArr[newArr.length - 1][1] + coins[i];

  }

}

if (change != 0) return newObj;

}

console.log(newArr);

cid.every((el) => el[1] == 0)

? ((newObj.status = "CLOSED"),

  (newObj.change = newArr.concat(cid.slice(newArr.length))))

: ((newObj.status = "OPEN"), (newObj.change = newArr));

return newObj;

}

console.log(

checkCashRegister(19.5, 20, [

["PENNY", 0.5],

["NICKEL", 0],

["DIME", 0],

["QUARTER", 0],

["ONE", 0],

["FIVE", 0],

["TEN", 0],

["TWENTY", 0],

["ONE HUNDRED", 0],

])

);
error

Challenge: Cash Register

Link to the challenge:

You probably need to google about floating number

You have found a floating point rounding error. This is inherent in how decimal numbers are represented in computers. You either need to convert to a fixed number of digits or do all of your calculations as an integer number of cents.

Side note: Javascript is not a compiled language.