79609036

Date: 2025-05-06 15:42:12
Score: 0.5
Natty:
Report link

OK, according to Metcalf, Reid, Cohen and Bader "Modern Fortran Explained incorporating Fortran 2023" the model for an integer number i of a given kind is (stupid stackoverflow not supporting MathJax...)

i = s * Sum_k w_k * r^{k-1}

where

I don't possess the standard but this is the same formula and interpretation is given in section 16.4 of "J3/24-007(Fortran 2023 Interpretation Document)"

Note how the above model is symmetric about zero. Thus if the maximum value supported for a given kind of integer is 2147483647, the most negative number that need be supported is -2147483647. Thus as I understand it gfortran is perfectly within its rights here to reject -2147483648 if the maximum is +2147483647.

I see nothing that stops a given implementation supporting integers for a given kind outside the range, only that as regards intrinsic numeric inquiry functions they behave as if the number were modelled by the above equation. Thus the intel compiler is also within its rights here, though personally I would like to to provide a diagnostic as a quality of implementation issue - but as I see it it is not required.

Reasons:
  • Blacklisted phrase (1): regards
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-1):
  • No code block (0.5):
  • High reputation (-1):
Posted by: Ian Bush