FA-97420 / Knitting and sewing pattern grading / Member archive
Yarn yardage estimator: metres per gram · case 05
A 50 g / 200 m fingering yarn is estimated to need fewer metres than grams.
Case contract
grams = garment_area / swatch_area * swatch_g; meters = grams * skein_m/skein_g; add margin_pct as a multiplier (meters*(1+margin/100)). skeins = ceiling(meters/skein_m); leftover = skeins*skein_m - meters. Return [meters, skeins, leftover] with meters and leftover half-up integers. Non-positive swatch area or skein weight -> "error: swatch".
Why this case matters
Designers and knitters estimate how many skeins to buy from a weighed swatch.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| with margin | [211, 2, 39] | [1320, 11, 55] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗