FA-97027 / Recipe scaling and nutrition / Member archive
Percent daily value formatter: vitamin d IU conversion · case 02
400 IU of vitamin D reports 80000% DV.
Case contract
DVs: sodium 2300 mg, fat 78 g, fiber 28 g, calcium 1300 mg, vitamin d 20 mcg, added sugars 50 g, protein 50 g. Names are trimmed, case-insensitive; unknown -> "error: no daily value". Units g, mg, mcg convert exactly; "iu" is allowed only for vitamin d (40 IU = 1 mcg), else "error: unit". pct = amount/DV*100. Zero -> "0%". Calcium and vitamin d: <2 -> "<2%", <=10 -> nearest 2, <=50 -> nearest 5, else nearest 10. Others: <1 -> "<1%", else nearest 1. Half-up.
Why this case matters
Label software prints %DV with different increments for micronutrients and macronutrients.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| vitamin d in IU | "80000%" | "50%" | 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 ↗