c===============================================================================
c========================================================Programa MachineEpsilon
c===============================================================================
      real*4 eps
      real*8 deps
	
c.....Simple Precision (REAL*4)
      call MEps_Simple(le2,eps)
      write(6,100) le2,eps
  100 format(' REAL*4 -> Machine Epsilon = 2**',i3,' = ',e15.6)

c.....Doble Precision (REAL*8)
      call MEps_Doble(lde2,deps)
      write(6,200) lde2,deps
  200 format(' REAL*8 -> Machine Epsilon = 2**',i3,' = ',d15.6)

      end


c_________________________________________________________Subroutine MEps_Simple
c     Obtencion del machine epsilon en simple precision

      Subroutine MEps_Simple(le2,eps)
      implicit real*4 (a-h,o-z)

      uno=1.e+00
      dos=2.e+00
      eps=1.e+00
      le2=0
      q  =uno+eps/dos

      do while (uno.ne.q)
        eps=eps/dos
        le2=le2-1
        q  =uno+eps/dos
      enddo

      return
      end


c__________________________________________________________Subroutine MEps_Doble
c     Obtencion del machine epsilon en doble precision

      Subroutine MEps_Doble(le2,eps)
      implicit real*8 (a-h,o-z)
      
      uno=1.d+00
      dos=2.d+00
      eps=1.d+00
      le2=0
      q  =uno+eps/dos

      do while (uno.ne.q)
        eps=eps/dos
        le2=le2-1
        q  =uno+eps/dos
      enddo

      return
      end
