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.

https://docwiki.embarcadero.com/RADStudio/Alexandria//en/Delphi_Considerations_for_Multi-Device_Applications#The_Extended_Data_Type_Is_2_Bytes_Smaller_on_64-bit_Windows_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.


Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.