Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

4.5.1 Arithmetic Expressions

  • Binary operations, such as + - * / cannot mix signed and unsigned operands. That is, U*N is illegal if U is declared UNSIGNED, and N is a signed INTEGER.

    • Use the UNSIGNED intrinsic function to combine mixed operands in a binary operation, as in U*UNSIGNED(N)

    • An exception is when one operand is an unsigned integer and the other is a signed integer constant expression with positive or zero value; the result is an unsigned integer.

    • The kind of the result of such a mixed expression is the largest kind of the operands.

    Exponentiation of a signed value is signed while exponentiation of an unsigned value is unsigned.

  • Unary minus of an unsigned value is unsigned.

  • Unsigned operands may mix freely with real, complex operands. (Unsigned operands cannot be mixed with interval operands.)