Most online construction calculators are glorified L × W ÷ 27 widgets. That works fine until a DIYer buys 9.2 linear feet of 12-ft carpet roll for a 10 × 10 ft room—only to find out at the warehouse that carpet doesn't rotate like liquid—or cuts a stair stringer whose riser height fails an IRC residential inspection by 3/16 of an inch.
While building FixUpMath in Astro and TypeScript, we tried to bridge the gap between raw geometry and the actual trade standards contractors use on site. Here are four concrete engineering lessons (with real TypeScript formulas) from implementing our core calculators.
1. Carpet Isn't a Liquid: Separating Area Budgets from CRI 105 Single-Piece Cuts
If you take a 10 × 10 ft bedroom, add 10% waste (110 ft²), and divide by a 12 ft carpet roll width, you get 9.17 linear feet. Yet a single seamless cut for that room requires 10 ft 6 in (10 ft + 3 in trim per wall per CRI 105 §5.3), which means the supplier actually bills you for 12 × 10.5 = 126 ft² (14 yd²) and leaves you a 1.5 ft remnant strip.
In our Carpet Calculator, we stopped dividing area by roll width and instead test both pile orientations explicitly, then render a to-scale SVG roll plan showing either the exact seamless cut + offcut strip or the seam line when both room dimensions exceed the roll width:
const trimAcrossRoomFt = (2 * 3) / 12; // 3 in trim per wall (CRI 105 §5.3) function singlePieceLength(runFt: number, acrossFt: number, rollFt: number): string { if (acrossFt + trimAcrossRoomFt > rollFt + 1e-9) return 'Needs a seam'; return `${Math.ceil((runFt + trimAcrossRoomFt) * 100) / 100} ft`; } 2. Wallpaper Pattern Repeats: Why a 21-Inch Repeat Changes Your Roll Count
A common bug in wallpaper estimators is adding one full repeat to every strip regardless of pattern type. On a 9 ft wall (108 in + 4 in trim = 112 in) with a 21 in repeat and a 33 ft (396 in) double roll:
- Adding a flat full repeat (
112 + 21 = 133 in) yields only 2 strips per roll. - With a straight match, the actual cut spacing is
ceil(112 / 21) × 21 = 126 in. Starting at0,126, and252 in, the third strip ends at364 in <= 396 in—yielding 3 strips per roll (cutting a 12 × 12 ft room from 16 rolls down to 11 rolls).
In our Wallpaper Calculator, we split random, straight-match, and drop-match calculations and render a to-scale single-roll strip map SVG so you can visually see where the pattern-match gaps and leftover tail land on the 33 ft roll.
3. Stair Stringers: Checking IRC R311.7 Limits & Framing Square Marks
A residential stair calculator isn't complete if it only outputs risers and stringer length. In our Stair Calculator, every live calculation runs a 5-point check against the International Residential Code (IRC Section R311.7):
- Max riser height (
≤ 7¾ in, IRC R311.7.5.1) - Min tread depth (
≥ 10 in, IRC R311.7.5.2) - Min clear width (
≥ 36 in, IRC R311.7.1) - Max vertical rise per flight (
≤ 151 in, IRC R311.7.3) - Comfort rule (
2R + Tbetween 24 and 25 in)
We also output the exact framing square marks (tongue = riser, blade = run) and pair it with our Rafter Calculator (which outputs plumb cut, seat cut, and framing square marks) plus non-interpolated published span lookups in our Joist Span Calculator (AWC DCA 6-15 Table 2) and Rafter Span Chart (SFPA 2013 Tables 17 & 19).
4. Electrical Conduit Fill: Adding NEC Chapter 9 Note 2 Jam Ratio
NEC Chapter 9 Table 1 sets maximum fill at 53% (1 wire), 31% (2 wires), and 40% (3+ wires). However, electricians pulling three equal-sized conductors around bends can still jam the pull even when fill is well under 40% if the ratio of conduit inner diameter to wire outer diameter (1.05 × D / d, accounting for bend ovality) lands between 2.8 and 3.2.
Because NEC Table 4 (conduit internal area) and Table 5 (THHN wire area) are both circular areas, D / d simplifies directly to Math.sqrt(conduitArea / wireArea):
export function jamRatio(conduitArea: number, wireArea: number) { const ratio = 1.05 * Math.sqrt(conduitArea / wireArea); return { ratio, risk: ratio >= 2.8 && ratio <= 3.2 }; } For example, pulling 3 × 3 AWG THHN (0.0973 in²) inside 1 in EMT (0.864 in²) gives a fill of only 33.8% (legal under 40%), yet a jam ratio of 3.13—squarely inside the 2.8–3.2 jamming zone! You can test mixed wire combinations and jam ratios live in our Conduit Fill Calculator (and check circuit drop in the Voltage Drop Calculator).
Open Reference & Test Vectors
All published building-code citations, mathematical formulas, and hand-verified test vectors (backed by 260+ Vitest assertions) are documented in our public GitHub reference repository:
- Reference & formulas: github.com/jiankn/fixupmath-standards
- Full Astro + TypeScript source: github.com/jiankn/fixupmath
- Methodology & Standards index: fixupmath.com/about/
If you spot an edge case against a local building code amendment or manufacturer spec sheet, PRs and issues are always welcome!
