```\n// ROUND\_HALF\_UP rule helper. 0.5 ≈ 1, 0.4 ≈ 0, -0.5 ≈ -1, -0.4 ≈ 0\nfunction roundHalfUp(int256 x, int256 y) internal pure returns (int256) {\n    require(y > 0, "roundHalfUp only supports y > 0");\n    if (x >= 0) {\n        return add(x, y / 2);\n    }\n    return sub(x, y / 2);\n}\n```\n