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.aup | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'benchmarks/tpcc/tpcc.aup') diff --git a/benchmarks/tpcc/tpcc.aup b/benchmarks/tpcc/tpcc.aup index b3e75aa..a67dc2e 100644 --- a/benchmarks/tpcc/tpcc.aup +++ b/benchmarks/tpcc/tpcc.aup @@ -3,6 +3,10 @@ # w * 10 + d, a customer district * 3000 + c, an order district * 10^7 + o, # an order line order * 16 + number, a stock item w * 100000 + i. # +# Money is an i64 of cents and a rate (tax, discount) an i64 of +# ten-thousandths (the specification's decimals, exactly: Pure 027's +# stage 5), as SQLite's INTEGER columns hold them. +# # Where this departs from the specification: a customer is always chosen by # number (never by last name), texts the transactions only carry along # (names, addresses, data) are left out, a customer keeps its last order, @@ -11,29 +15,29 @@ record Warehouse { id = 0 - tax = 0 - ytd = 0 + tax: i64 + ytd: i64 } record District { id = 0 - tax = 0 - ytd = 0 + tax: i64 + ytd: i64 next_order = 3001 next_delivery = 2101 } record Customer { id = 0 - discount = 0 + discount: i64 credit = 1 - balance = -10 - ytd_payment = 10 + balance: i64 = -1000 + ytd_payment: i64 = 1000 payments = 1 deliveries = 0 last_order = 0 } record Item { id = 0 - price = 0 + price: i64 } record Stock { id = 0 @@ -59,13 +63,13 @@ record Line { supply = 0 delivery = 0 quantity = 0 - amount = 0 + amount: i64 } record History { customer = 0 district = 0 date = 0 - amount = 0 + amount: i64 } record Ordered { item = 0 @@ -183,7 +187,7 @@ on new_order { } count = count + 1 lines.add(Line { id: order * 16 + count, item: l.item, supply: l.supply, quantity: l.quantity, - amount: l.quantity * price }) + amount: i64(l.quantity) * price }) } orders.add(Order { id: order, customer: customer.id, entry: now, lines: count, local: local }) new_orders.add(NewOrder { id: order }) @@ -198,7 +202,7 @@ input payment = message { cw: u32 cd: u32 c: u32 - amount: number + amount: i64 } on payment { let warehouse = warehouses[payment.w] @@ -227,7 +231,7 @@ on delivery { new_orders.remove(new_orders[order]) let o = orders[order] o.carrier = delivery.carrier - let total = 0 + let total = i64(0) for l in lines[order * 16 .. order * 16 + 16] { l.delivery = now total = total + l.amount -- cgit v1.2.3