Skip to content

API Reference

obbba-overtime exposes a small surface: a Params struct, a FilingStatus enum, and four free functions. All money values are f64 dollars. Every function is clamping-safe: negative inputs are treated as zero and the phase-out math never panics.

Params

pub struct Params {
    pub cap: f64,
    pub phase_out_start: f64,
    pub phase_out_rate: f64,
}

Filing-status-dependent deduction parameters. All fields are the estimated statutory values; they are configurable so the crate can track IRS guidance as it finalizes.

  • cap — maximum deduction for the full (under-threshold) overtime amount.
  • phase_out_start — MAGI at which the phase-out begins.
  • phase_out_rate — dollars of deduction lost per dollar of MAGI above the threshold. The widely reported "$1 per $10 of MAGI" → 0.1.

Constants

impl Params {
    pub const SINGLE: Params;  // cap 12,500  start 150,000  rate 0.1
    pub const JOINT:  Params;  // cap 25,000  start 300,000  rate 0.1
}

phase_out_end

pub fn phase_out_end(&self) -> f64

MAGI at which the deduction is fully phased out (reaches $0), equal to phase_out_start + cap / phase_out_rate. For the single defaults that is $150,000 + $12,500 / 0.1 = $275,000.

use obbba_overtime::Params;
assert!((Params::SINGLE.phase_out_end() - 275_000.0).abs() < 1e-6);

FilingStatus

pub enum FilingStatus { Single, Joint }

Selects default [Params].

pub fn default_params(self) -> Params

Returns the estimated default parameters for the filing status.

use obbba_overtime::{FilingStatus, Params};
assert_eq!(FilingStatus::Single.default_params(), Params::SINGLE);
assert_eq!(FilingStatus::Joint.default_params(),  Params::JOINT);

effective_cap

pub fn effective_cap(magi: f64, params: Params) -> f64

The maximum deduction available to a taxpayer with the given MAGI, before considering how much overtime they actually earned (i.e., the lesser of the statutory cap and what the phase-out leaves available).

Returns the effective cap at that income. Below the phase-out start it equals params.cap; above the phase-out end it equals 0; between them it falls off linearly.

use obbba_overtime::{effective_cap, Params};
let p = Params::SINGLE;
assert!((effective_cap(90_000.0, p)  - 12_500.0).abs() < 1e-6);  // under threshold
assert!((effective_cap(160_000.0, p) - 11_500.0).abs() < 1e-6);  // $10k over → −$1,000
assert!((effective_cap(275_000.0, p)).abs() < 1e-6);             // fully phased out
assert_eq!(effective_cap(300_000.0, p), 0.0);                    // above end

deduction

pub fn deduction(qualified_overtime: f64, magi: f64, status: FilingStatus) -> f64

Estimated overtime deduction for a taxpayer, using the default params for status.

qualified_overtime is the FLSA overtime compensation received (typically the premium half-time portion, 0.5 × OT hours × hourly rate, but callers should follow the IRS definition). magi is Modified Adjusted Gross Income. The deduction is the lesser of the overtime earned and the effective cap at the taxpayer's MAGI. All inputs are clamped non-negative.

use obbba_overtime::{deduction, FilingStatus};
assert!((deduction(8_000.0,  90_000.0, FilingStatus::Single) -  8_000.0).abs() < 1e-6);
assert!((deduction(40_000.0, 90_000.0, FilingStatus::Single) - 12_500.0).abs() < 1e-6); // capped
assert!((deduction(50_000.0, 200_000.0, FilingStatus::Joint) - 25_000.0).abs() < 1e-6);
assert_eq!(deduction(-1_000.0, 90_000.0, FilingStatus::Single), 0.0);                   // negative clamped

deduction_with

pub fn deduction_with(qualified_overtime: f64, magi: f64, params: Params) -> f64

Same as deduction but with explicit [Params], to override the filing-status defaults (e.g. to plug in revised IRS figures as guidance finalizes).

use obbba_overtime::{deduction_with, Params};
let custom = Params { cap: 5_000.0, phase_out_start: 100_000.0, phase_out_rate: 0.2 };
assert!((deduction_with(20_000.0, 90_000.0, custom) - 5_000.0).abs() < 1e-6); // custom cap

tax_savings

pub fn tax_savings(
    qualified_overtime: f64,
    magi: f64,
    marginal_rate: f64,
    status: FilingStatus,
) -> f64

Estimated federal income-tax savings from the overtime deduction, given a marginal tax rate (e.g. 0.22 for the 22% bracket):

savings = deduction(qualified_overtime, magi, status) × marginal_rate

This is a simplified estimate: it assumes the deduction reduces income taxed entirely at the marginal rate and ignores interactions with other phase-outs, AMT, and state tax. marginal_rate is clamped to be non-negative.

use obbba_overtime::{tax_savings, FilingStatus};
// $10k OT fully deductible at 22% → $2,200 savings
let s = tax_savings(10_000.0, 80_000.0, 0.22, FilingStatus::Single);
assert!((s - 2_200.0).abs() < 1e-6);