Why is my calculation in JavaScript wrong? [duplicate]

developers!
Please, help me to find out why when I subtract from the user_input (1.89) the price (1.87) my result is 0.019999999999999796 instead of 0.02?

When the user_input is 2.87 the result is correct, 1.



let price = 1.87;



const sale = () => {

  let user_input = Number(cash.value);

  let result = "";

  const cashMinusPrice = () => {result = user_input - price;

  console.log(result);

  return result};



I tried to use different user_inpit values, something happens when the result is not a flat number