FAILURE MAP
← Case archive

FA-63993 / Medication dosing calculations / Member archive

Meal and correction insulin bolus with insulin on board: pen half-unit rounding · case 03

A 5.9 unit calculation is delivered as 6 units.

Member previewVariant 3 · 3 implementations · 8 checks per implementation

Case contract

Input {bg, target, isf, carbs_g, icr, iob, max_units}. Toy rule: bg < 70 returns HOLD with 0 units. correction = (bg-target)/isf; when positive, insulin on board is subtracted from it and the result floored at 0; a negative correction (bg below target) is kept and reduces the meal dose. meal = carbs_g/icr. total = max(0, meal + correction), capped at max_units, then rounded DOWN to 0.5 units. Return {action GIVE|HOLD, units}.

Why this case matters

Bolus calculators combine several unit ratios and safety rules; insulin-on-board, hypoglycaemia holds and pen resolution are separate decision points.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
high glucose with insulin on board{"action": "GIVE", "units": 10.0}{"action": "GIVE", "units": 9.5}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 ↗