Fmt.round_even: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/tui/fmt.bend as Fmt Lines 52-57 of cswap-bend-cli@0.1.0.0/tui/fmt.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/tui/fmt.bend&start_line=52&end_line=57 import Base # Centi-percent (4750 = 47.5 %) to a whole percent, halves to even as Python's # `f"{pct:.0f}"` does. def round_even(+c: U32) -> U32: sel.u(U32.is_lt((c % 100 : U32), 50), (c / 100 : U32), sel.u(U32.is_gt((c % 100 : U32), 50), ((c / 100 : U32) + 1 : U32), sel.u(U32.is_eq((((c / 100 : U32)) % 2 : U32), 0), (c / 100 : U32), ((c / 100 : U32) + 1 : U32)))) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_gt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mod https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/tui/fmt.bend&name=sel.u