      SUBROUTINE ROUNDOFF(ipower,value)

C     ROUNDOFF ROUNDS OFF A GIVEN VALUE TO A GIVEN POWER OF TEN

      i=abs(ipower)

      x=1.
      y=.1
      do 50 ii=1,i
       x=x*10.
       y=y/10.
50    continue

      if ( ipower .lt. 0 ) then       

       val2=value*x
       val3=val2*10.

       ival2=val2
       val2=ival2

       res=mod(val3,10.)
       if ( res .ge. 5. ) val2=val2+1.

       value2=val2/x

       if ( value-value2 .ge. y ) then
        value2=value2+y
       elseif ( value-value2 .le. -y ) then
        value2=value2-y
       endif

       value=value2

      else

       value = value - mod(value,x)

      endif

      return
      end

