Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

if then or min/max ?

drob__douglas
Beginner
613 Views

Hello All,

Which would execute quicker? This

Code:

IMIN = INT((XP-XMIN-RMAX)/DX) + 1
IMAX = INT((XP-XMIN+RMAX)/DX) + 1
IMIN = MAX(IMIN,1) IMAX = MIN(IMAX,NR) JMIN = INT((YP-YMIN-RMAX)/DY) + 1 JMAX = INT((YP-YMIN+RMAX)/DY) + 1 JMIN = MAX(JMIN,1) JMAX = MIN(JMAX,NR)

or this,

Code:

IMIN = INT((XP-XMIN-RMAX)/DX) + 1
IMAX = INT((XP-XMIN+RMAX)/DX) + 1
IF (IMIN .LT. 1) IMIN = 1
IF (IMAX .GT. NR) IMAX = NR
JMIN = INT((YP-YMIN-RMAX)/DY) + 1
JMAX = INT((YP-YMIN+RMAX)/DY) + 1
IF (JMIN .LT. 1) JMIN = 1
IF (JMAX .GT. NR) JMAX = NR

or is the compiler smart enough to make themequvalent?

Thanks in advance.

- Doug

0 Kudos
1 Reply
Intel_C_Intel
Employee
613 Views
compiler is smart enough.
0 Kudos
Reply