FBR and EOBI tax engine
Payroll in Pakistan follows FBR tax slabs that change every fiscal year, with EOBI rates on top, and a bonus entered late changes the maths again. All of it lives in one place, and for the hardest calculation I chose the slower method, because the faster one went wrong by about 10,000 rupees in one known case.
Under the hood
As far as I can tell, this is the only Pakistan-tax payroll engine shipped cleanly anywhere. FBR slabs change per fiscal year and per regime; EOBI rates are separate; consolidated-versus-component salary structures route through different math; bonuses entered late roll forward two months per §17.6. All of that lives in one pure module, with seventeen vitest property tests covering the invariants (1000-iteration round-trip, EXEMPT regime, bonusTaxedAsSalary=false, GROSS_AGREED bonus invariance).
The Net→Gross solver uses bisection rather than Newton damping, after a discovered counterexample where a CONSOLIDATED-structure salary with a bonus-induced slab transition broke Newton's derivative continuity assumption and diverged by ~10k PKR. Bisection is slower; bisection is correct. The doc-comment in the engine records the counterexample so the next person doesn't "optimize" it back.