From defb2cf06a9b5db9429ca368d8c2af127a5c9c3d Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 01:53:40 +0100 Subject: 027's 5c: money as i64 minor units shown by .Nd: NUM_TEXT's decimal form takes digits (bits 20-24 as FIXED's), an integer's last N digits written after a point (1234 at two is 12.34, -5 -0.05, 0 0.00; width and zeros after the sign), verification allowing digits on FIXED and DECIMAL alone; unit test: ten rows of formats_and_held (-2^63 at two, 25 digits, a number's whole 1234, its 12.5 a limit); TPC-C's money i64 cents and its rates ten-thousandths (tables, messages, load, the transactions), SQLite's INTEGER columns and int64 bindings alike, the comparison now exact (no 1e-9 tolerance): after 20,000 transactions every row of every table the same (grouped SQLite too) and 3.3.2 holding on both; counts: b45 against b44 BFS without batches +0.09%, the rest within 0.001%; the bank's queries (s44 and s45 in turns, six each) in_credit -0.59%, per_branch -0.34%, ranks -0.20%, the rest within 0.01%, the seven answers the same bytes; 008 (NUM_TEXT's digits, a message row's i64 cells), 027 and 092 --- benchmarks/tpcc/tpcc-load.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'benchmarks/tpcc/tpcc-load.c') diff --git a/benchmarks/tpcc/tpcc-load.c b/benchmarks/tpcc/tpcc-load.c index 176ec1e..d3cee99 100644 --- a/benchmarks/tpcc/tpcc-load.c +++ b/benchmarks/tpcc/tpcc-load.c @@ -118,8 +118,8 @@ static void prepare(Connection *c) { do cw = uniform(r, 1, warehouses); while (cw == w); cd = uniform(r, 1, 10); } - double amount = uniform(r, 100, 500000) / 100.0; - length = snprintf(body, sizeof(body), "{\"w\":%d,\"d\":%d,\"cw\":%d,\"cd\":%d,\"c\":%d,\"amount\":%.2f}", w, d, cw, + int amount = uniform(r, 100, 500000); /* cents */ + length = snprintf(body, sizeof(body), "{\"w\":%d,\"d\":%d,\"cw\":%d,\"cd\":%d,\"c\":%d,\"amount\":%d}", w, d, cw, cd, customer, amount); path = "/inputs/payment"; } else if (c->kind == DELIVERY) { -- cgit v1.2.3