      SUBROUTINE ARONDI(XMIN,XMAX,XX,PROP,NDX,NTMAX)
      PARAMETER (NPUIMAXI=20)
      REAL*8 X,DX,LOGDX,XX(*),PUIS(-NPUIMAXI:NPUIMAXI),XMIN2,XMAX2
      REAL*8 ECHE,XXX(100)
      DIMENSION PROP(*)
      LOGICAL*4 LXX(100)
C
C Determination de l'echelle a afficher en fonction des bornes
C
      IF (XMIN.EQ.XMAX) THEN
        NDX = 0
        RETURN
      ENDIF
      DO I=-NPUIMAXI,NPUIMAXI
        PUIS(I) = 10.D0**I
      ENDDO
      DDX = XMAX-XMIN
      DX = DBLE(DDX)
      LOGDX = DLOG10(DX)
      MANT = INT(LOGDX)
      IF (LOGDX.LT.0.) MANT=MANT-1
C
      NDX = 0
      XMIN2 = XMIN - .1D0*DX
      XMAX2 = XMAX + .1D0*DX
      N0 = DNINT(XMIN2*PUIS(-MANT))
      N1 = DNINT(XMAX2*PUIS(-MANT))
      ECHE = PUIS(MANT)
      XMIN2 = ECHE*DBLE(N0)
      XMAX2 = ECHE*DBLE(N1)
      DO 100 I=N0,N1-1
        X = DBLE(I)*ECHE
        CALL LETEST(X,XMIN2,XMAX2,XXX,LXX,NDX,.TRUE.)
        DO 200 J=1,4
          X = (DBLE(I) + .2D0*DBLE(J) )*ECHE
          CALL LETEST(X,XMIN2,XMAX2,XXX,LXX,NDX,.FALSE.)
  200   CONTINUE
  100 CONTINUE
      CALL LETEST(XMAX2,XMIN2,XMAX2,XXX,LXX,NDX,.TRUE.)
C
cc      IF (NDX.LT.50) THEN
      IF (NDX.LT.25) THEN
        DO 150 I=N0,N1-1
          DO 250 J=1,9,2
            X = (DBLE(I) + .1D0*DBLE(J))*ECHE
            IF (J.NE.5) THEN
              CALL LETEST(X,XMIN2,XMAX2,XXX,LXX,NDX,.FALSE.)
            ELSE
              CALL LETEST(X,XMIN2,XMAX2,XXX,LXX,NDX,.TRUE.)
            ENDIF
  250     CONTINUE
  150   CONTINUE
      ENDIF
C
      EPS = 1.D-5*DX
      XMIN2 = XMIN - EPS 
      XMAX2 = XMAX + EPS 
      NN = 0
      USDDX = 1./DDX
      DO N=1,NDX
        IF (LXX(N)) THEN
          IF (XXX(N).GE.XMIN2.AND.XXX(N).LE.XMAX2) THEN
            NN = NN+1
            XX(NN) = XXX(N)
            PROP(NN) = (REAL(XX(NN))-XMIN)*USDDX
          ENDIF
        ENDIF
      ENDDO
      NDX = NN     
C
      IF (NDX.GT.NTMAX) THEN
        PRINT*,'BUGBUG',NDX,NTMAX
        STOP
      ENDIF
C
      END
C===============================================================
      SUBROUTINE LETEST(X,XMIN,XMAX,XX,LXX,NDX,LOGIC)
      REAL*8 X,XX(*),XMIN,XMAX
      LOGICAL*4 LXX(*),LOGIC
C
      IF ( X.GE.XMIN .AND. X.LE.XMAX ) THEN
        NDX = NDX+1
        XX(NDX)  = X
        LXX(NDX) = LOGIC
      ENDIF
      END
