I need to translate the following C # code in Delphi:
decimal XYZ = decimal.Round(dataset123.XYZ, 5, MidpointRounding.AwayFromZero);
The result will be saved in the float field in the MSSQL database.
When I work with doubleDelphi, there are several problems, since it is not a fixed decimal. In addition, when you save to the ADO database, the database viewer often displays a very long number because it contains too many digits. In addition, there is a problem with the rounding method, where rounding is not always performed “from scratch”.
I want to solve the most serious problem at the moment. I need a five-digit currency, but Delphi has only a data type currencythat has 4 digits. The presence of a 5-digit value is an important requirement for this project / business process.
In some internet sources, I read what people say about this code:
var
x: Decimal[5,3]
But this syntax is not valid for me. I am working with Delphi 2007.
Is there anything I can do to get a 5 digit fixed decimal place?
source
share