! Last change: DOS 24 Jul 2000 8:20 pm ! *** copyright 2000 *** ! *** filename fixex.f95 *** John F. Monahan ** ! ********************** program fixex ! demonstration of fixed point numbers implicit none integer (kind=2) :: i,j integer (kind=2), dimension(10) :: ilist ! using integer, kind=2 is equivalent to M=16 20 format(2x,i6,2x,z8) ! data ilist /1,21,27,48,96,112,144,224,282,32767/ ! write output here open( unit=6, file='fixex.out' ) ! do about as many numbers as appear in Section 2 do i = 1,10 j = ilist(i) write(6,20) j,j ! also write their negatives j = - j write(6,20) j,j end do ! loop on i ! the last one is the most negative, what will happen ! when we subtract one and then negate? j = j - 1 write(6,20) j,j j = -j write(6,20) j,j stop end program fixex ! *** end of filename fixex.f95 *********************