X-Git-Url: http://git.scottworley.com/inverse-tax/blobdiff_plain/b442070b44917301d40c5a6cbf996898175908be..2d75ab3b4dcad01ee65123f680363d45bd9578a3:/tax.js?ds=sidebyside diff --git a/tax.js b/tax.js index cd0027a..2687387 100644 --- a/tax.js +++ b/tax.js @@ -58,7 +58,6 @@ function invert(table) { // for gross: // net - b = m * gross // (net - b) / m = gross - // and the calculate the inverse's bounds const ms = table.map(([start, end, rate]) => 1 - rate); const full_brackets = [0].concat(table.map(([start, end, rate]) => (end - start) * rate)).slice(0, table.length); @@ -84,7 +83,7 @@ function invert(table) { }); return function(net) { for (const [start, end, m, b] of inverse_table) { - if (start < net && net < end) { + if (start <= net && net <= end) { return (net - b) / m; } }