kumi 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +60 -116
- data/golden/array_element/expected/schema_ruby.rb +1 -1
- data/golden/array_index/expected/schema_ruby.rb +1 -1
- data/golden/array_operations/expected/schema_ruby.rb +1 -1
- data/golden/cascade_logic/expected/schema_ruby.rb +1 -1
- data/golden/chained_fusion/expected/schema_ruby.rb +1 -1
- data/golden/element_arrays/expected/schema_ruby.rb +1 -1
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +1 -1
- data/golden/game_of_life/expected/lir_00_unoptimized.txt +33 -33
- data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +33 -33
- data/golden/game_of_life/expected/lir_02_inlined.txt +296 -296
- data/golden/game_of_life/expected/lir_03_cse.txt +128 -128
- data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +128 -128
- data/golden/game_of_life/expected/lir_04_loop_invcm.txt +128 -128
- data/golden/game_of_life/expected/lir_06_const_prop.txt +128 -128
- data/golden/game_of_life/expected/schema_ruby.rb +1 -1
- data/golden/hash_keys/expected/schema_ruby.rb +1 -1
- data/golden/hash_keys/schema.kumi +4 -5
- data/golden/hash_value/expected/schema_ruby.rb +1 -1
- data/golden/hierarchical_complex/expected/schema_ruby.rb +1 -1
- data/golden/inline_rename_scope_leak/expected/ast.txt +48 -0
- data/golden/inline_rename_scope_leak/expected/input_plan.txt +10 -0
- data/golden/inline_rename_scope_leak/expected/lir_00_unoptimized.txt +35 -0
- data/golden/inline_rename_scope_leak/expected/lir_01_hoist_scalar_references.txt +35 -0
- data/golden/inline_rename_scope_leak/expected/lir_02_inlined.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_03_cse.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_04_1_loop_fusion.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/nast.txt +31 -0
- data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +51 -0
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +82 -0
- data/golden/inline_rename_scope_leak/expected/snast.txt +31 -0
- data/golden/inline_rename_scope_leak/expected.json +7 -0
- data/golden/inline_rename_scope_leak/input.json +4 -0
- data/golden/inline_rename_scope_leak/schema.kumi +24 -0
- data/golden/input_reference/expected/schema_ruby.rb +1 -1
- data/golden/interleaved_fusion/expected/schema_ruby.rb +1 -1
- data/golden/let_inline/expected/schema_ruby.rb +1 -1
- data/golden/loop_fusion/expected/schema_ruby.rb +1 -1
- data/golden/min_reduce_scope/expected/schema_ruby.rb +1 -1
- data/golden/mixed_dimensions/expected/schema_ruby.rb +1 -1
- data/golden/multirank_hoisting/expected/schema_ruby.rb +1 -1
- data/golden/nested_hash/expected/schema_ruby.rb +1 -1
- data/golden/reduction_broadcast/expected/schema_ruby.rb +1 -1
- data/golden/roll/expected/lir_00_unoptimized.txt +8 -8
- data/golden/roll/expected/lir_01_hoist_scalar_references.txt +8 -8
- data/golden/roll/expected/lir_02_inlined.txt +8 -8
- data/golden/roll/expected/lir_03_cse.txt +8 -8
- data/golden/roll/expected/lir_04_1_loop_fusion.txt +8 -8
- data/golden/roll/expected/lir_04_loop_invcm.txt +8 -8
- data/golden/roll/expected/lir_06_const_prop.txt +8 -8
- data/golden/roll/expected/schema_ruby.rb +1 -1
- data/golden/shift/expected/lir_00_unoptimized.txt +12 -12
- data/golden/shift/expected/lir_01_hoist_scalar_references.txt +12 -12
- data/golden/shift/expected/lir_02_inlined.txt +12 -12
- data/golden/shift/expected/lir_03_cse.txt +12 -12
- data/golden/shift/expected/lir_04_1_loop_fusion.txt +12 -12
- data/golden/shift/expected/lir_04_loop_invcm.txt +12 -12
- data/golden/shift/expected/lir_06_const_prop.txt +12 -12
- data/golden/shift/expected/schema_ruby.rb +1 -1
- data/golden/shift_2d/expected/lir_00_unoptimized.txt +48 -48
- data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +48 -48
- data/golden/shift_2d/expected/lir_02_inlined.txt +48 -48
- data/golden/shift_2d/expected/lir_03_cse.txt +48 -48
- data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +48 -48
- data/golden/shift_2d/expected/lir_04_loop_invcm.txt +48 -48
- data/golden/shift_2d/expected/lir_06_const_prop.txt +48 -48
- data/golden/shift_2d/expected/schema_ruby.rb +1 -1
- data/golden/simple_math/expected/schema_ruby.rb +1 -1
- data/golden/streaming_basics/expected/schema_ruby.rb +1 -1
- data/golden/tuples/expected/lir_00_unoptimized.txt +4 -4
- data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +4 -4
- data/golden/tuples/expected/lir_02_inlined.txt +4 -4
- data/golden/tuples/expected/lir_03_cse.txt +4 -4
- data/golden/tuples/expected/lir_04_1_loop_fusion.txt +4 -4
- data/golden/tuples/expected/lir_04_loop_invcm.txt +4 -4
- data/golden/tuples/expected/lir_06_const_prop.txt +4 -4
- data/golden/tuples/expected/schema_ruby.rb +1 -1
- data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +1 -1
- data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +1 -1
- data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_03_cse.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +2 -2
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +1 -1
- data/golden/us_tax_2024/expected/ast.txt +865 -0
- data/golden/us_tax_2024/expected/input_plan.txt +61 -0
- data/golden/us_tax_2024/expected/lir_00_unoptimized.txt +901 -0
- data/golden/us_tax_2024/expected/lir_01_hoist_scalar_references.txt +901 -0
- data/golden/us_tax_2024/expected/lir_02_inlined.txt +5178 -0
- data/golden/us_tax_2024/expected/lir_03_cse.txt +2499 -0
- data/golden/us_tax_2024/expected/lir_04_1_loop_fusion.txt +2519 -0
- data/golden/us_tax_2024/expected/lir_04_loop_invcm.txt +2439 -0
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +2439 -0
- data/golden/us_tax_2024/expected/nast.txt +976 -0
- data/golden/us_tax_2024/expected/schema_javascript.mjs +584 -0
- data/golden/us_tax_2024/expected/schema_ruby.rb +639 -0
- data/golden/us_tax_2024/expected/snast.txt +976 -0
- data/golden/us_tax_2024/expected.json +1 -0
- data/golden/us_tax_2024/input.json +168 -0
- data/golden/us_tax_2024/schema.kumi +203 -0
- data/golden/with_constants/expected/schema_ruby.rb +1 -1
- data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +181 -105
- data/lib/kumi/core/analyzer/passes/output_schema_pass.rb +6 -4
- data/lib/kumi/core/functions/function_spec.rb +14 -8
- data/lib/kumi/core/functions/loader.rb +1 -1
- data/lib/kumi/version.rb +1 -1
- metadata +33 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"summary": {"single": {"federal": {"marginal": 0.22, "effective": 0.13841, "tax": 13841.0}, "fica": {"effective": 0.0765, "tax": 7650.0}, "state": {"marginal": 0.06, "effective": 0.06, "tax": 6000.0}, "local": {"marginal": 0.0388, "effective": 0.0388, "tax": 3880.0}, "total": {"effective": 0.31371, "tax": 31371.0}, "after_tax": 68629.0, "retirement_contrib": 0, "take_home": 68629.0}, "married_joint": {"federal": {"marginal": 0.12, "effective": 0.08032, "tax": 8032.0}, "fica": {"effective": 0.0765, "tax": 7650.0}, "state": {"marginal": 0.06, "effective": 0.06, "tax": 6000.0}, "local": {"marginal": 0.0388, "effective": 0.0388, "tax": 3880.0}, "total": {"effective": 0.25562, "tax": 25562.0}, "after_tax": 74438.0, "retirement_contrib": 0, "take_home": 74438.0}, "married_separate": {"federal": {"marginal": 0.22, "effective": 0.13841, "tax": 13841.0}, "fica": {"effective": 0.0765, "tax": 7650.0}, "state": {"marginal": 0.06, "effective": 0.06, "tax": 6000.0}, "local": {"marginal": 0.0388, "effective": 0.0388, "tax": 3880.0}, "total": {"effective": 0.31371, "tax": 31371.0}, "after_tax": 68629.0, "retirement_contrib": 0, "take_home": 68629.0}, "head_of_household": {"federal": {"marginal": 0.22, "effective": 0.10541, "tax": 10541.0}, "fica": {"effective": 0.0765, "tax": 7650.0}, "state": {"marginal": 0.06, "effective": 0.06, "tax": 6000.0}, "local": {"marginal": 0.0388, "effective": 0.0388, "tax": 3880.0}, "total": {"effective": 0.28071, "tax": 28071.0}, "after_tax": 71929.0, "retirement_contrib": 0, "take_home": 71929.0}}}
|
@@ -0,0 +1,168 @@
|
|
1
|
+
{
|
2
|
+
"income": 100000,
|
3
|
+
"state_rate": 0.06,
|
4
|
+
"local_rate": 0.0388,
|
5
|
+
"retirement_contrib": 0,
|
6
|
+
"fed": {
|
7
|
+
"single": {
|
8
|
+
"std": 14600,
|
9
|
+
"rates": [
|
10
|
+
{
|
11
|
+
"lo": 0,
|
12
|
+
"hi": 11600,
|
13
|
+
"rate": 0.1
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"lo": 11600,
|
17
|
+
"hi": 47150,
|
18
|
+
"rate": 0.12
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"lo": 47150,
|
22
|
+
"hi": 100525,
|
23
|
+
"rate": 0.22
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"lo": 100525,
|
27
|
+
"hi": 191950,
|
28
|
+
"rate": 0.24
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"lo": 191950,
|
32
|
+
"hi": 243725,
|
33
|
+
"rate": 0.32
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"lo": 243725,
|
37
|
+
"hi": 609350,
|
38
|
+
"rate": 0.35
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"lo": 609350,
|
42
|
+
"hi": -1,
|
43
|
+
"rate": 0.37
|
44
|
+
}
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"married_joint": {
|
48
|
+
"std": 29200,
|
49
|
+
"rates": [
|
50
|
+
{
|
51
|
+
"lo": 0,
|
52
|
+
"hi": 23200,
|
53
|
+
"rate": 0.1
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"lo": 23200,
|
57
|
+
"hi": 94300,
|
58
|
+
"rate": 0.12
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"lo": 94300,
|
62
|
+
"hi": 201050,
|
63
|
+
"rate": 0.22
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"lo": 201050,
|
67
|
+
"hi": 383900,
|
68
|
+
"rate": 0.24
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"lo": 383900,
|
72
|
+
"hi": 487450,
|
73
|
+
"rate": 0.32
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"lo": 487450,
|
77
|
+
"hi": 731200,
|
78
|
+
"rate": 0.35
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"lo": 731200,
|
82
|
+
"hi": -1,
|
83
|
+
"rate": 0.37
|
84
|
+
}
|
85
|
+
]
|
86
|
+
},
|
87
|
+
"married_separate": {
|
88
|
+
"std": 14600,
|
89
|
+
"rates": [
|
90
|
+
{
|
91
|
+
"lo": 0,
|
92
|
+
"hi": 11600,
|
93
|
+
"rate": 0.1
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"lo": 11600,
|
97
|
+
"hi": 47150,
|
98
|
+
"rate": 0.12
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"lo": 47150,
|
102
|
+
"hi": 100525,
|
103
|
+
"rate": 0.22
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"lo": 100525,
|
107
|
+
"hi": 191950,
|
108
|
+
"rate": 0.24
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"lo": 191950,
|
112
|
+
"hi": 243725,
|
113
|
+
"rate": 0.32
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"lo": 243725,
|
117
|
+
"hi": 365600,
|
118
|
+
"rate": 0.35
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"lo": 365600,
|
122
|
+
"hi": -1,
|
123
|
+
"rate": 0.37
|
124
|
+
}
|
125
|
+
]
|
126
|
+
},
|
127
|
+
"head_of_household": {
|
128
|
+
"std": 21900,
|
129
|
+
"rates": [
|
130
|
+
{
|
131
|
+
"lo": 0,
|
132
|
+
"hi": 16550,
|
133
|
+
"rate": 0.1
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"lo": 16550,
|
137
|
+
"hi": 63100,
|
138
|
+
"rate": 0.12
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"lo": 63100,
|
142
|
+
"hi": 100500,
|
143
|
+
"rate": 0.22
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"lo": 100500,
|
147
|
+
"hi": 191950,
|
148
|
+
"rate": 0.24
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"lo": 191950,
|
152
|
+
"hi": 243700,
|
153
|
+
"rate": 0.32
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"lo": 243700,
|
157
|
+
"hi": 609350,
|
158
|
+
"rate": 0.35
|
159
|
+
},
|
160
|
+
{
|
161
|
+
"lo": 609350,
|
162
|
+
"hi": -1,
|
163
|
+
"rate": 0.37
|
164
|
+
}
|
165
|
+
]
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
@@ -0,0 +1,203 @@
|
|
1
|
+
schema do
|
2
|
+
input do
|
3
|
+
float :income
|
4
|
+
float :state_rate
|
5
|
+
float :local_rate
|
6
|
+
float :retirement_contrib
|
7
|
+
|
8
|
+
hash :fed do
|
9
|
+
hash :single do
|
10
|
+
float :std
|
11
|
+
array :rates do
|
12
|
+
hash :bracket do
|
13
|
+
float :lo
|
14
|
+
float :hi # -1 = open-ended
|
15
|
+
float :rate
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
hash :married_joint do
|
20
|
+
float :std
|
21
|
+
array :rates do
|
22
|
+
hash :bracket do
|
23
|
+
float :lo
|
24
|
+
float :hi
|
25
|
+
float :rate
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
hash :married_separate do
|
30
|
+
float :std
|
31
|
+
array :rates do
|
32
|
+
hash :bracket do
|
33
|
+
float :lo
|
34
|
+
float :hi
|
35
|
+
float :rate
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
hash :head_of_household do
|
40
|
+
float :std
|
41
|
+
array :rates do
|
42
|
+
hash :bracket do
|
43
|
+
float :lo
|
44
|
+
float :hi
|
45
|
+
float :rate
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# ——— shared helpers ———
|
53
|
+
let :big_hi, 100_000_000_000.0
|
54
|
+
let :state_tax, input.income * input.state_rate
|
55
|
+
let :local_tax, input.income * input.local_rate
|
56
|
+
|
57
|
+
# FICA constants
|
58
|
+
let :ss_wage_base, 168_600.0
|
59
|
+
let :ss_rate, 0.062
|
60
|
+
let :med_base_rate, 0.0145
|
61
|
+
let :addl_med_rate, 0.009
|
62
|
+
|
63
|
+
# thresholds differ by filing status
|
64
|
+
let :addl_threshold_single, 200_000.0
|
65
|
+
let :addl_threshold_mj, 250_000.0
|
66
|
+
let :addl_threshold_ms, 125_000.0
|
67
|
+
let :addl_threshold_hoh, 200_000.0
|
68
|
+
|
69
|
+
# ——— SINGLE ———
|
70
|
+
let :taxable_single, fn(:max, [input.income - input.fed.single.std, 0])
|
71
|
+
let :lo_s, input.fed.single.rates.bracket.lo
|
72
|
+
let :hi_s, input.fed.single.rates.bracket.hi
|
73
|
+
let :rate_s, input.fed.single.rates.bracket.rate
|
74
|
+
let :hi_s_eff, select(hi_s == -1, big_hi, hi_s)
|
75
|
+
let :amt_s, fn(:clamp, taxable_single - lo_s, 0, hi_s_eff - lo_s)
|
76
|
+
let :fed_tax_single, fn(:sum, amt_s * rate_s)
|
77
|
+
let :in_br_s, (taxable_single >= lo_s) & (taxable_single < hi_s_eff)
|
78
|
+
let :fed_marginal_single, fn(:sum_if, rate_s, in_br_s)
|
79
|
+
let :fed_eff_single, fed_tax_single / fn(:max, [input.income, 1.0])
|
80
|
+
|
81
|
+
let :ss_tax_s, fn(:min, [input.income, ss_wage_base]) * ss_rate
|
82
|
+
let :med_tax_s, input.income * med_base_rate
|
83
|
+
let :addl_med_tax_s, fn(:max, [input.income - addl_threshold_single, 0]) * addl_med_rate
|
84
|
+
let :fica_tax_single, ss_tax_s + med_tax_s + addl_med_tax_s
|
85
|
+
let :fica_eff_single, fica_tax_single / fn(:max, [input.income, 1.0])
|
86
|
+
|
87
|
+
let :total_tax_single, fed_tax_single + fica_tax_single + state_tax + local_tax
|
88
|
+
let :total_eff_single, total_tax_single / fn(:max, [input.income, 1.0])
|
89
|
+
let :after_tax_single, input.income - total_tax_single
|
90
|
+
let :take_home_single, after_tax_single - input.retirement_contrib
|
91
|
+
|
92
|
+
# ——— MARRIED JOINT ———
|
93
|
+
let :taxable_mj, fn(:max, [input.income - input.fed.married_joint.std, 0])
|
94
|
+
let :lo_mj, input.fed.married_joint.rates.bracket.lo
|
95
|
+
let :hi_mj, input.fed.married_joint.rates.bracket.hi
|
96
|
+
let :rate_mj, input.fed.married_joint.rates.bracket.rate
|
97
|
+
let :hi_mj_eff, select(hi_mj == -1, big_hi, hi_mj)
|
98
|
+
let :amt_mj, fn(:clamp, taxable_mj - lo_mj, 0, hi_mj_eff - lo_mj)
|
99
|
+
let :fed_tax_mj, fn(:sum, amt_mj * rate_mj)
|
100
|
+
let :in_br_mj, (taxable_mj >= lo_mj) & (taxable_mj < hi_mj_eff)
|
101
|
+
let :fed_marginal_mj, fn(:sum_if, rate_mj, in_br_mj)
|
102
|
+
let :fed_eff_mj, fed_tax_mj / fn(:max, [input.income, 1.0])
|
103
|
+
|
104
|
+
let :ss_tax_mj, ss_tax_s
|
105
|
+
let :med_tax_mj, med_tax_s
|
106
|
+
let :addl_med_tax_mj, fn(:max, [input.income - addl_threshold_mj, 0]) * addl_med_rate
|
107
|
+
let :fica_tax_mj, ss_tax_mj + med_tax_mj + addl_med_tax_mj
|
108
|
+
let :fica_eff_mj, fica_tax_mj / fn(:max, [input.income, 1.0])
|
109
|
+
|
110
|
+
let :total_tax_mj, fed_tax_mj + fica_tax_mj + state_tax + local_tax
|
111
|
+
let :total_eff_mj, total_tax_mj / fn(:max, [input.income, 1.0])
|
112
|
+
let :after_tax_mj, input.income - total_tax_mj
|
113
|
+
let :take_home_mj, after_tax_mj - input.retirement_contrib
|
114
|
+
|
115
|
+
# ——— MARRIED SEPARATE ———
|
116
|
+
let :taxable_ms, fn(:max, [input.income - input.fed.married_separate.std, 0])
|
117
|
+
let :lo_ms, input.fed.married_separate.rates.bracket.lo
|
118
|
+
let :hi_ms, input.fed.married_separate.rates.bracket.hi
|
119
|
+
let :rate_ms, input.fed.married_separate.rates.bracket.rate
|
120
|
+
let :hi_ms_eff, select(hi_ms == -1, big_hi, hi_ms)
|
121
|
+
let :amt_ms, fn(:clamp, taxable_ms - lo_ms, 0, hi_ms_eff - lo_ms)
|
122
|
+
let :fed_tax_ms, fn(:sum, amt_ms * rate_ms)
|
123
|
+
let :in_br_ms, (taxable_ms >= lo_ms) & (taxable_ms < hi_ms_eff)
|
124
|
+
let :fed_marginal_ms, fn(:sum_if, rate_ms, in_br_ms)
|
125
|
+
let :fed_eff_ms, fed_tax_ms / fn(:max, [input.income, 1.0])
|
126
|
+
|
127
|
+
let :ss_tax_ms, ss_tax_s
|
128
|
+
let :med_tax_ms, med_tax_s
|
129
|
+
let :addl_med_tax_ms, fn(:max, [input.income - addl_threshold_ms, 0]) * addl_med_rate
|
130
|
+
let :fica_tax_ms, ss_tax_ms + med_tax_ms + addl_med_tax_ms
|
131
|
+
let :fica_eff_ms, fica_tax_ms / fn(:max, [input.income, 1.0])
|
132
|
+
|
133
|
+
let :total_tax_ms, fed_tax_ms + fica_tax_ms + state_tax + local_tax
|
134
|
+
let :total_eff_ms, total_tax_ms / fn(:max, [input.income, 1.0])
|
135
|
+
let :after_tax_ms, input.income - total_tax_ms
|
136
|
+
let :take_home_ms, after_tax_ms - input.retirement_contrib
|
137
|
+
|
138
|
+
# ——— HEAD OF HOUSEHOLD ———
|
139
|
+
let :taxable_hoh, fn(:max, [input.income - input.fed.head_of_household.std, 0])
|
140
|
+
let :lo_h, input.fed.head_of_household.rates.bracket.lo
|
141
|
+
let :hi_h, input.fed.head_of_household.rates.bracket.hi
|
142
|
+
let :rate_h, input.fed.head_of_household.rates.bracket.rate
|
143
|
+
let :hi_h_eff, select(hi_h == -1, big_hi, hi_h)
|
144
|
+
let :amt_h, fn(:clamp, taxable_hoh - lo_h, 0, hi_h_eff - lo_h)
|
145
|
+
let :fed_tax_hoh, fn(:sum, amt_h * rate_h)
|
146
|
+
let :in_br_h, (taxable_hoh >= lo_h) & (taxable_hoh < hi_h_eff)
|
147
|
+
let :fed_marginal_hoh, fn(:sum_if, rate_h, in_br_h)
|
148
|
+
let :fed_eff_hoh, fed_tax_hoh / fn(:max, [input.income, 1.0])
|
149
|
+
|
150
|
+
let :ss_tax_h, ss_tax_s
|
151
|
+
let :med_tax_h, med_tax_s
|
152
|
+
let :addl_med_tax_h, fn(:max, [input.income - addl_threshold_hoh, 0]) * addl_med_rate
|
153
|
+
let :fica_tax_hoh, ss_tax_h + med_tax_h + addl_med_tax_h
|
154
|
+
let :fica_eff_hoh, fica_tax_hoh / fn(:max, [input.income, 1.0])
|
155
|
+
|
156
|
+
let :total_tax_hoh, fed_tax_hoh + fica_tax_hoh + state_tax + local_tax
|
157
|
+
let :total_eff_hoh, total_tax_hoh / fn(:max, [input.income, 1.0])
|
158
|
+
let :after_tax_hoh, input.income - total_tax_hoh
|
159
|
+
let :take_home_hoh, after_tax_hoh - input.retirement_contrib
|
160
|
+
|
161
|
+
value :summary, {
|
162
|
+
single: {
|
163
|
+
federal: { marginal: fed_marginal_single, effective: fed_eff_single, tax: fed_tax_single },
|
164
|
+
fica: { effective: fica_eff_single, tax: fica_tax_single },
|
165
|
+
state: { marginal: input.state_rate, effective: input.state_rate, tax: state_tax },
|
166
|
+
local: { marginal: input.local_rate, effective: input.local_rate, tax: local_tax },
|
167
|
+
total: { effective: total_eff_single, tax: total_tax_single },
|
168
|
+
after_tax: after_tax_single,
|
169
|
+
retirement_contrib: input.retirement_contrib,
|
170
|
+
take_home: take_home_single
|
171
|
+
},
|
172
|
+
married_joint: {
|
173
|
+
federal: { marginal: fed_marginal_mj, effective: fed_eff_mj, tax: fed_tax_mj },
|
174
|
+
fica: { effective: fica_eff_mj, tax: fica_tax_mj },
|
175
|
+
state: { marginal: input.state_rate, effective: input.state_rate, tax: state_tax },
|
176
|
+
local: { marginal: input.local_rate, effective: input.local_rate, tax: local_tax },
|
177
|
+
total: { effective: total_eff_mj, tax: total_tax_mj },
|
178
|
+
after_tax: after_tax_mj,
|
179
|
+
retirement_contrib: input.retirement_contrib,
|
180
|
+
take_home: take_home_mj
|
181
|
+
},
|
182
|
+
married_separate: {
|
183
|
+
federal: { marginal: fed_marginal_ms, effective: fed_eff_ms, tax: fed_tax_ms },
|
184
|
+
fica: { effective: fica_eff_ms, tax: fica_tax_ms },
|
185
|
+
state: { marginal: input.state_rate, effective: input.state_rate, tax: state_tax },
|
186
|
+
local: { marginal: input.local_rate, effective: input.local_rate, tax: local_tax },
|
187
|
+
total: { effective: total_eff_ms, tax: total_tax_ms },
|
188
|
+
after_tax: after_tax_ms,
|
189
|
+
retirement_contrib: input.retirement_contrib,
|
190
|
+
take_home: take_home_ms
|
191
|
+
},
|
192
|
+
head_of_household: {
|
193
|
+
federal: { marginal: fed_marginal_hoh, effective: fed_eff_hoh, tax: fed_tax_hoh },
|
194
|
+
fica: { effective: fica_eff_hoh, tax: fica_tax_hoh },
|
195
|
+
state: { marginal: input.state_rate, effective: input.state_rate, tax: state_tax },
|
196
|
+
local: { marginal: input.local_rate, effective: input.local_rate, tax: local_tax },
|
197
|
+
total: { effective: total_eff_hoh, tax: total_tax_hoh },
|
198
|
+
after_tax: after_tax_hoh,
|
199
|
+
retirement_contrib: input.retirement_contrib,
|
200
|
+
take_home: take_home_hoh
|
201
|
+
}
|
202
|
+
}
|
203
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
2
|
-
module Kumi::Compiled::
|
2
|
+
module Kumi::Compiled::KUMI_637cda4c2c7cf245cb3f0b33719df27309bc57cdf29851183113d43acd8b22fe
|
3
3
|
def self.from(input_data = nil)
|
4
4
|
instance = Object.new
|
5
5
|
instance.extend(self)
|