According to the Nested WHERE Constructs stream in comp.lang.fortran (especially Jan's answer), it seems that the first code in the Question translates to the following:
do i = 1, size( arrayA )
if ( arrayA( i ) > 0 ) then
diff_frac( i ) = 1.5 * arrayA( i )
endif
enddo
do i = 1, size( arrayA )
if ( arrayA( i ) > 0 ) then
if ( diff_frac( i ) > 2 ) then
arrayC( i ) = arrayC( i ) + diff_frac( i )
endif
endif
enddo
, , (. ). F2008 :
7.2.3 - WHERE (. 161)
7.2.3.2 (. 162)
... 2. WHERE .
... 4. -expr .
... 8. WHERE, where-body, , m_c.AND. -.
... 10. where-assign-stmt -expr , , , .
/, diff_frac( i ) > 2 arrayA( i ) > 0, IF- ( , A .and. B Fortran ).
, , ... , gfortran5.2, ifort14.0 Oracle fortran 12.4 ( )
integer, dimension(4) :: x, y, z
integer :: i
x = [1,2,3,4]
y = 0 ; z = 0
where ( 2 <= x )
y = x
where ( 3.0 / y < 1.001 ) !! possible division by zero
z = -10
end where
end where
print *, "x = ", x
print *, "y = ", y
print *, "z = ", z
:
x = 1 2 3 4
y = 0 2 3 4
z = 0 0 -10 -10
gfortran -ffpe-trap=zero
ifort -fpe0
f95 -ftrap=division (or with -fnonstd)
gfortran ifort , y(i) = 0 , f95 . ( , Cray gfortran/ifort, NAG/PGI/XLF f95.)
, "" WHERE, , ( . 7.2.3.2, 9 ). ,
integer, dimension(4) :: a, b, c
a = [ 1, 2, 3, 4 ]
b = -1 ; c = -1
where ( 3 <= a )
b = a * 100
c = sum( b )
endwhere
a = 1 2 3 4
b = -1 -1 300 400
c = -1 -1 698 698
, (b) = 698 b, .