I am struggling to get the float number to show correctly. It works for the most part. For example, if I input 0.2 in "kWh" and 0.04 in "Hours used", it outputs 0.008 in "Total. However, when I change these values to 0.02 and 0.23, it outputs 0.046000000000000006. Why doesn't it output 0.046 instead? What am I missing here?
<script>
        function calculate(){
            var amount = document.getElementById("kW").value;
            var amount = parseFloat(amount).toFixed(2);
            var quantity = document.getElementById("hours").value;
            var quantity = parseFloat(quantity).toFixed(2);
            var total = amount * quantity;
            document.getElementById("total").value = total;
        }
    </script><div class="kWattsCol">
                <p><b>kWh</b></p>
                <input type="number" oninput="calculate()" id="kW" required>
            </div>
            <div class="hoursCol">
                <p><b>Hours used</b></p>
                <input type="number" oninput="calculate()" id="hours"required>
            </div>
            <div class="totalCol">
                <p><b>Total</b></p>
                <input type="text" id="total" readonly>
            </div> 
     
    