FAILURE MAP
← Case archive

FA-63864 / Medication dosing calculations / Member archive

Weight-based dose with ideal and adjusted dosing weight: half-up dose rounding · case 04

Doses that land exactly half-way between 5 mg steps, and many others, are rounded down.

Member previewVariant 4 · 3 implementations · 9 checks per implementation

Case contract

Input {sex, height_in, weight, unit ("kg" or "lb", 1 kg = 2.2 lb), mg_per_kg, max_mg}. Toy rule: IBW = 50 kg (sex "M") or 45.5 kg (otherwise) + 2.3 kg per inch above 60 in (never below the base). Dosing weight is actual weight when below IBW, IBW when actual is within 100-120% of IBW inclusive, and IBW + 0.4*(actual-IBW) when actual exceeds 120% of IBW. Dose = mg_per_kg * dosing weight rounded half-up to the nearest 5 mg, then capped at max_mg. Return {basis, dosing_weight_kg (1 decimal), dose_mg}.

Why this case matters

Weight-based ordering tools must choose the stipulated dosing weight band, convert units exactly, and apply the ceiling after the final rounding step.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
pound entry converted to kilograms{"basis": "adjusted", "dose_mg": 80, "dosing_weight_kg": 83.8}{"basis": "adjusted", "dose_mg": 85, "dosing_weight_kg": 83.8}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 ↗