FAILURE MAP
← Case archive

FA-96880 / Recipe scaling and nutrition / Member archive

Nutrition label rounding: calorie coarse band step · case 05

65 kcal prints as 65 instead of 70.

Member previewVariant 5 · 3 implementations · 8 checks per implementation

Case contract

Round a panel dict to displayed strings (toy label rules, half-up): calories <5 -> 0, <=50 -> nearest 5, else nearest 10; fat g <0.5 -> 0, <5 -> nearest 0.5, else nearest 1; sodium mg <5 -> 0, <=140 -> nearest 5, else nearest 10; cholesterol mg <2 -> "0 mg", <5 -> "less than 5 mg", else nearest 5; carbs g <0.5 -> "0 g", <1 -> "less than 1 g", else nearest 1. Absent keys are omitted. Values print with %g formatting.

Why this case matters

Packaged food and meal-kit labels are generated from recipe nutrition totals with banded rounding rules that differ per nutrient.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
regression: calorie coarse band step{"calories": "105", "cholesterol": "10 mg", "fat": "1.5 g", "sodium": "10 mg"}{"calories": "110", "cholesterol": "10 mg", "fat": "1.5 g", "sodium": "10 mg"}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 ↗