However, the TPC-H spec converts to integer first for the calculations and HammerDB using floating point so the calculation is incorrect and orders and lineitem totals do not match.
To Reproduce
Check the sum of lineitems for the same orderkey with discount and tax applied and it should be the same as o_totalprice in orders. At the moment it is not the same.
Expected behavior
The sum of lineitems for the same orderkey with discount and tax applied is the same as o_totalprice for all orderkeys.
HammerDB Version (please complete the following information):
Version: [e.g. 4.8]
Build: [e.g. Release download or build from source]
HammerDB Interface (please complete the following information):
UI: [e.g. GUI or CLI] All
Operating System (please complete the following information):
Server OS: [e.g. RHEL8]
Client OS: [e.g. Windows 11] All
Database Server (please complete the following information):
Database name: [e.g. PostgreSQL] All
Database Release Version [e.g. 15.2]
Database Client (please complete the following information):
Database client name: [e.g. ODBC Driver 18 for SQL Server] All
Additional context
The fix is for HammerDB to take the same approach as the specification and use integer for the calculations, so they match.
Describe the bug In the TPROC-H schema build (and refresh function) the TPC-H specification calculates o_totalprice as follows:
o->totalprice +=((o->l[lcnt].eprice (100 - o->l[lcnt].discount)) / PENNIES) (100 + o->l[lcnt].tax) / PENNIES;
HammerDB does the following:
set totalprice [format %4.2f [ expr {$totalprice + [ expr {(($leprice (100 - $ldiscount)) / 100) (100 + $ltax) / 100} ]}]]
However, the TPC-H spec converts to integer first for the calculations and HammerDB using floating point so the calculation is incorrect and orders and lineitem totals do not match.
To Reproduce Check the sum of lineitems for the same orderkey with discount and tax applied and it should be the same as o_totalprice in orders. At the moment it is not the same.
Expected behavior The sum of lineitems for the same orderkey with discount and tax applied is the same as o_totalprice for all orderkeys.
HammerDB Version (please complete the following information):
HammerDB Interface (please complete the following information):
Operating System (please complete the following information):
Database Server (please complete the following information):
Database Client (please complete the following information):
Additional context The fix is for HammerDB to take the same approach as the specification and use integer for the calculations, so they match.