I have a a form where a user can make a simple multiplication of two fields. The outcome of the equation is then placed in another input field using jquery.
quantity = Number($('#quantity').val());
price = Number($('#price').val());
subtotal = quantity * price;
and
$("input#subtotal").val(subtotal);
But...The numbers do not add up!!
I'm getting very strange answers with long decimals behind the comma. When running my console:
console.log(subtotal, price+ "x" + quantity + "=" + subtotal);
it literally states:
--> 1.07 x 1001 = 1071.0700000000002
What is the best solution here?