LLVM Rounding when double is multiplied by currency
Summary
When targeting LLVM backend, rounding/truncation occurs when multiplying a double with more than 4 decimal places by an currency
System Information
OS tested: Linux, fedora 38 CPU: x86_64, LLVM Compiler: Trunk, latest; Device: PC
Steps to reproduce
Multiply a double with more than 4dp with a currency type
Example Project
Will attach, but generally trivial:
uses
Math;
var
Ccy1,
Ccy2 : Currency;
Dbl : Double;
begin
Dbl := 1.50125;
Ccy1 := 1000000;
Dbl := Dbl * Ccy1;
WriteLn('(Double) Dbl * Ccy1 = ', Dbl:6:0, ' expected 1_501_250 SameValue: ', SameValue(Dbl, Double(1501250)));
What is the current bug behavior?
Output is rounded/truncated, 1.50125 * 1_000_000 = 1_501_200
What is the expected (correct) behavior?
No rounding in the example cases; consistent with non-LLVM FPC behaviour 1.50125 * 1_000_000 = 1_501_250
Relevant logs and/or screenshots
None
Edited by Kieran Martin