Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
doubleprecision | :: | x |
doubleprecision function mat_round(x) doubleprecision :: x,y,z,e doubleprecision,parameter :: h=1.0d9 z = dabs(x) y = z + 1.0d0 if (y .ne. z)then y = 0.0d0 e = h do if (e .ge. z) exit e = 2.0d0*e enddo do if (e .le. h) exit if (e .le. z) y = y + e if (e .le. z) z = z - e e = e/2.0d0 enddo z = int(z + 0.5d0) y = y + z if (x .lt. 0.0d0) y = -y mat_round = y else mat_round = x endif end function mat_round