2

Dear Ada Enthusiasts,

type Long_Money_Type is delta 10.0**(-22) digits 38;

On The First Machine Ubuntu Linux 64 bit GNAT 8.3.0 this works.
On The Second Machine Alpine Linux 64 Bit GNAT 10.3.1 20211027 i get this error:

adx-lib-money.ads:14:29: scale exceeds maximum value of 18
adx-lib-money.ads:14:54: digits value out of range, maximum is 18

Is There an way to change the maximum value ?

2 Answers 2

4

This problem doesn’t occur with GCC 11 and later, so it looks as though you need to upgrade.

3
  • thank you Simon Wright GNAT 13.1.1 20230722 works..
    – mcxbain
    Aug 20 at 18:23
  • 1
    Could this be related to the introduction of 128-bit Integers in GNAT, which happened just a few years ago?
    – egilhh
    Aug 21 at 6:53
  • 1
    @egilhh, Long_Money_Type’Size is 128 on macOS for GCC 11/12/13; ’Alignment is 16. So 128-bit integer support is indeed needed. Aug 22 at 16:29
1

Expanding on @Simon Wright's answer, the Ada standard identifies certain Implementation-Defined Characteristics in a way that "allows for certain machine dependences in a controlled manner". In particular,

What combinations of small, range, and digits are supported for fixed point types. See 3.5.9(10).

As a concrete example, the GNAT 12.2 Reference Manual responds as follows:

For a decimal fixed point type, on 32-bit platforms, the small must lie in 1.0E-18 .. 1.0E+18 and the digits in 1 .. 18. On 64-bit platforms, the small must lie in 1.0E-38 .. 1.0E+38 and the digits in 1 .. 38.

As a result, when searching for a suitable upgrade, verify that you choose the 64-bit version if both are available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.