i wanna make rand number without using functions
PROGRAM RTEST
PARAMETER (N=100)
IMPLICIT REAL(A-H,O-Z), INTEGER(I-N)
DIMENSION A(N)
OPEN(99,FILE='RANDOM.DAT',FORM='FORMATTED')
IBMO=3149
SUM=0.0
DO 5 I=1,N
IBMO=IBMO*65549
IF(IBMO) 101, 102, 102
101 IBMO=IBMO+2147483647+1
102 RANDOM=0.46566128E-9*IBMO
A(I)=RANDOM
WRITE(99,10)I,A(I)
WRITE(6,10) I,A(I)
10 FORMAT(5X,I4,3X,F12.7)
SUM=SUM+A(I)
AVE1=SUM/FLOAT(N)
20 FORMAT(12X,F12.7)
30 FORMAT(5X,I4,3X,F12.7)
WRITE(6,20) AVE1
WRITE(99,30)I,AVE1
5 CONTINUE
CLOSE(99)
AVE=SUM/FLOAT(N)
WRITE(6,*)AVE
PAUSE
STOP
END
but i always got integer overflow or invalid floating point error.....
so what my think was type error
i try to change real
>> real*8
and integer
>> integer*8
but every try was fail....
what is problem?
Aucun commentaire:
Enregistrer un commentaire