关于计算公式问题求解。

img


如图,表格和代码计算出来的有误差,求解。

html>
<html>
<head>
    <meta charset="UTF-8">
    <title>个人所得税计算器title>
    <script>
        function calculateTax() {
            var income = parseFloat(document.getElementById("income").value);
            var tax;
            if (income <= 100) {
                tax = income * 0.0144; // 级数1:100万以下,费率是1.440%
            } else if (income <= 500) {
                tax = (income - 100) * 0.01056 + 1.44; // 级数2:100-500万,费率是1.056%
            } else if (income <= 1000) {
                tax = (income - 500) * 0.00768 + 5.616; // 级数3:500-1000万,费率是0.768%
            } else if (income <= 5000) {
                tax = (income - 1000) * 0.00480 + 14.256; // 级数4:1000-5000万,费率是0.480%
            } else if (income <= 10000) {
                tax = (income - 5000) * 0.00240 + 49.416; // 级数5:5000-10000万,费率是0.240%
            } else if (income <= 100000) {
                tax = (income - 10000) * 0.00048 + 97.416; // 级数6:10000-100000万,费率是0.048%
            } else {
                tax = (income - 100000) * 0.000096 + 145.416; // 级数7:100000万以上,费率是0.0096%
            }
            document.getElementById("tax").innerHTML = tax.toFixed(4);
        }
    script>
head>
<body>
<h1>个人所得税计算器h1>
<p>请输入您的收入金额(单位:万元):

<input type="text" id="income"> <button type="button" onclick="calculateTax()">计算button> <p>您需要缴纳的个人所得税为:<span id="tax">span>万元。

body> html>

img


这两种计算结果都没问题啊,你两个计算公式不相等,公式的问题