Cobol: Use struct int128 for fixed-point arithmetic.
Refactors Cobol's fixed-point arithmetic to use a more convenient `struct int128` with `rdigits` member.
This commit enhances the Cobol compiler’s handling of fixed-point arithmetic by utilizing a struct int128 that includes an rdigits member. This structure simplifies the implementation by embedding the number of digits to the right of the decimal point directly within the data type, rather than managing it through external logic. The change impacts various functions across gcc/cobol and libgcobol that deal with numeric comparisons, multiplications, divisions, and formatting.
In Details
The libgcobol library's numeric and formatting functions, particularly those involving fixed-point arithmetic, have been refactored to use a struct int128 that explicitly stores the number of rdigits (digits to the right of the decimal point). This change streamlines operations like multiplication and division by keeping the scale information integral to the operands, replacing separate scale tracking logic.
- fixed-point arithmetic
- Arithmetic operations on numbers where the position of the decimal point is fixed and does not change.
- struct int128
- A data structure representing a 128-bit integer, used here to accommodate large fixed-point numbers.
- rdigits
- Represents the number of digits to the right of the decimal point in a fixed-point number.
- libgcobol
- The Cobol runtime library for GCC, providing support for Cobol language features.