Skip to content

Commit

Permalink
Merge pull request #2769 from martinholmer/fix-arpa-ctc-phaseout
Browse files Browse the repository at this point in the history
Add exact calculation logic to CTC_new function
  • Loading branch information
martinholmer authored Jul 8, 2024
2 parents 9a8cbfd + 3779d50 commit 9b758a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 9 additions & 3 deletions taxcalc/calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3218,7 +3218,7 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300,
def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17,
CTC_new_refund_limited, CTC_new_refund_limit_payroll_rt,
CTC_new_refund_limited_all_payroll, payrolltax,
CTC_new_refund_limited_all_payroll, payrolltax, exact,
n24, nu06, age_head, age_spouse, nu18, c00100, MARS, ptax_oasdi,
c09200, ctc_new):
"""
Expand Down Expand Up @@ -3246,6 +3246,8 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
New child tax credit refund limit applies to all FICA taxes, not just OASDI
payrolltax: float
Total (employee + employer) payroll tax liability
exact: int
Whether or not exact phase-out calculation is being done
n24: int
Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17
nu06: int
Expand Down Expand Up @@ -3280,8 +3282,12 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
ctc_new = min(CTC_new_rt * posagi, ctc_new)
ymax = CTC_new_ps[MARS - 1]
if posagi > ymax:
ctc_new_reduced = max(0.,
ctc_new - CTC_new_prt * (posagi - ymax))
over = posagi - ymax
if exact == 1: # exact calculation as on tax form
excess = math.ceil(over / 1000.) * 1000.
else: # smoothed calculation
excess = over
ctc_new_reduced = max(0., ctc_new - CTC_new_prt * excess)
ctc_new = min(ctc_new, ctc_new_reduced)
if ctc_new > 0. and CTC_new_refund_limited:
refund_new = max(0., ctc_new - c09200)
Expand Down
6 changes: 4 additions & 2 deletions taxcalc/tests/test_calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ def test_ChildDepTaxCredit_2022(test_tuple, expected_value, skip_jit):
CTC_new_refund_limit_payroll_rt = 0.0
CTC_new_refund_limited_all_payroll = False
payrolltax = 0
exact = 0
n24 = 0
nu06 = 0
age_head = 45
Expand All @@ -758,7 +759,7 @@ def test_ChildDepTaxCredit_2022(test_tuple, expected_value, skip_jit):
CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17,
CTC_new_refund_limited, CTC_new_refund_limit_payroll_rt,
CTC_new_refund_limited_all_payroll, payrolltax,
CTC_new_refund_limited_all_payroll, payrolltax, exact,
n24, nu06, age_head, age_spouse, nu18, c00100, MARS, ptax_oasdi,
c09200, ctc_new)
# output tuple is : (ctc_new)
Expand Down Expand Up @@ -786,6 +787,7 @@ def test_CTCnew_2021(test_tuple, expected_value, skip_jit):
CTC_new_refund_limit_payroll_rt = 0.0
CTC_new_refund_limited_all_payroll = False
payrolltax = 0
exact = 0
n24 = 0
nu06 = 0
age_head = 45
Expand All @@ -801,7 +803,7 @@ def test_CTCnew_2021(test_tuple, expected_value, skip_jit):
CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17,
CTC_new_refund_limited, CTC_new_refund_limit_payroll_rt,
CTC_new_refund_limited_all_payroll, payrolltax,
CTC_new_refund_limited_all_payroll, payrolltax, exact,
n24, nu06, age_head, age_spouse, nu18, c00100, MARS, ptax_oasdi,
c09200, ctc_new)
# output tuple is : (ctc_new)
Expand Down

0 comments on commit 9b758a0

Please sign in to comment.