Avoid mixing integer and floating-point (float, double, or long double) data in the same computation. Expressing all numbers in a floating-point arithmetic expression (assignment statement) as floating-point values eliminates the need to convert data between fixed and floating-point formats. Expressing all numbers in an integer arithmetic expression as integer values also achieves this. This improves run-time performance.

For example, assuming that I and J are both int variables, expressing a constant number (2.) as an integer value (2) eliminates the need to convert the data. The following examples demonstrate inefficient and efficient code.

## Examples

Inefficient Code Example

```int I, J;
I = J / 2.
;```

Efficient Code Example

```int I, J;
I = J / 2;```

## Special Considerations for Auto-Vectorization of the Innermost Loops

Auto-vectorization of an innermost loop packs multiple data elements from consecutive loop iterations into a vector register, each of which is 128-bit (SSE) or 256 bit (AVX) in size.

Consider a loop that uses different sized data, for example, REAL and DOUBLE PRECISION. For REAL data, the compiler tries to pack data elements from four (SSE) or eight (AVX) consecutive iterations (32 bits x 4 = 128 bits, 32 bits x 8 = 256 bits). For DOUBLE PRECISION data, the compiler tries to pack data elements from two (SSE) or four (AVX) consecutive iterations (64 bits x 2 = 128 bits, 64 bits x 4 = 256 bits). Because of the mismatched number of iterations, the compiler sometimes fails to perform auto-vectorization of the loop, after trying to automatically remedy the situation.

If your attempt to auto-vectorize an innermost loop fails, it is a good practice to try using the same sized data. INTEGER and REAL are considered same sized data since both are 32-bit in size.

## Examples

Example 1: Not auto-vectorizable code

```DOUBLE PRECISION A(N), B(N)
REAL C(N), D(N)
DO I=1, N
A(I)=D(I)
C(I)=B(I)
ENDDO```

Example 2: Auto-vectorizable after automatic distribution into two loops

```DOUBLE PRECISION A(N), B(N)
REAL C(N), D(N)
DO I=1, N
A(I)=B(I)
C(I)=D(I)
ENDDO```

Example 3: Auto-vectorizable as one loop

```REAL A(N), B(N)
REAL C(N), D(N)
DO I=1, N
A(I)=B(I)
C(I)=D(I)
ENDDO```