FA-63969 / Medication dosing calculations / Member archive
Tablet strength selection with scored halves: tolerance percentage base · case 04
Large doses are rejected even when the percentage deviation is within tolerance.
Case contract
Input {target_mg, strengths, scored (strengths that may be halved), tol_pct}. For each strength s: step = s/2 if s is scored else s; units = target/step rounded half-up (skip if 0); dose = units*step; tablets = dose/s (skip if more than 4 tablets); keep only |dose-target|*100 <= tol_pct*target. Prefer smallest absolute error, then fewest physical tablets (ceil of tablets), then the largest strength. Return {status OK, strength, tablets, dose_mg} or {status NO_MATCH}.
Why this case matters
Dispensing systems translate an ordered dose into real tablets; halving rules, tolerance, and ranking are separate decisions.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| tolerance measured against target | {"status": "NO_MATCH"} | {"dose_mg": 150.0, "status": "OK", "strength": 150, "tablets": 1.0} | 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 ↗