Re: Form k = i + j and test for overflow.



Gary Scott wrote:

More so however, when the vendor first did something the "right" way and changed to do it the "wrong" way. For example, IBM once made a change in VS Fortran that meant you could no longer initialize integers with the max negative 32-bit integer value (-2147483648) commonly used to set a specific bit pattern for binary flag values. At first they refused to change it back claiming it was fully standard compliant, but after about 6 months of my first complaint (and an angry subsequent one), they released an update that put it back the "correct" way.

I would probably initialize with a hex constant, which hopefully
still worked. In C it is usual to use either the hex constant
or -2147483647-1, that is, a constant expression.

In expressions in both Fortran and C, constants are positive
and - is the unary negation operator. Initializers (for DATA
statements in Fortran 66) are specifically signed constants.
It would be usual, though likely not required, for signed
integer constant to include the most negative constant on
twos complement machines.

-- glen

.



Relevant Pages

  • Re: I know this has been discussed before, but...
    ... It is in all cases I know of in Fortran and C. ... the result type of unary negation ... is signed regardless of the signedness of the operand. ... were to directly specify that integer overflow wrapped the result ...
    (comp.lang.fortran)
  • Re: Form k = i + j and test for overflow.
    ... I would probably initialize with a hex constant, ... In expressions in both Fortran and C, ... and - is the unary negation operator. ...
    (comp.lang.fortran)
  • Re: logical operator in fortran 90
    ... Dave Seaman wrote: ... >>I'm having the following problem with fortran 90 using logical ... >>get a totally different answer of what I was expecting for. ...
    (comp.lang.fortran)