FastReport - wrong calculations in aggregate functions (32 vs 64 bit) and HideZeros problem
Hello.
We have problem with calculations in aggregate functions related to float fields in database, because calculations work different in WIN32 environment against WIN64 environment.
We use Delphi 11.3 and FastReport 2023.1.3.
All numbers are stored in database with 2 decimal places precision.
When I display numbers with more decimals places, than some numbers have more than 2 decimals.
For example, number 8.558,97 is represented as 8.558,96999999999987
When looking at sums, than we can see that there is difference in sum when program is build in WIN32 against WIN64 environment..
As is visible in pictures, when i set HideZeros property to TRUE, i still get "0,00" or "-0,00", probably because number is internally represented as -0,0000000000232381.
The reason for that is because FastReport uses "Extended" type for numbers, and "Extended" type is 2 Bytes smaller on WIN64 systems.
I found solution in extra rounding of SUM expresions to 2 decimal places, but that solutions requires changing of all existing reports, so that is not a good solution.
[SUM(<frxDS."TURNOVER_UNPAID">,MasterData1,1)] to
[ROUND(SUM(<frxDS."TURNOVERUNPAID">,MasterData1,1) * 100) /100]
Is there any solution that reports work in the same way independent if Delphi build as WIN32 or WIN64, and that zeros are hidden if we showing numbers in 2 decimal places and result is 0,00?
Here is a small project for testing.