ABL DECIMAL and .NET System.Decimal
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
ABL DECIMAL and .NET System.Decimal
The following example raises a run-time error
because a large ABL DECIMAL is passed to a .NET System.Decimal method
parameter:
|
A .NET System.Decimal can
hold a positive or negative value with a maximum of 29 digits (79,228,162,514,264,337,593,543,950,335),
and the specified ABL DECIMAL value passed to the System.Decimal parameter
has 37 digits, including 2 digits to the right of the decimal point.
The
following example truncates the least significant digits of the
result from dividing one .NET System.Decimal value
by another and storing it in the ABL DECIMAL variable, dResult:
|
In this case, the maximum System.Decimal value is
divided by 1028. In a CLS-compliant language, the result
of this calculation is a System.Decimal with the
value of 7.9228162514264337593543950335. However, an
ABL DECIMAL cannot represent a value with more
than 10 digits to the right of the decimal point. So, the value
of the dResult variable is 7.9228162514,
truncating the least significant 18 digits.