This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] patch for PR 15149 - problem computing PI


Bud Davis wrote:

test suite file


! pr 15149
! note this is not a test of the random
! number generator, just that "something"
! exists and returns values not always 0
TYPE point_type
 SEQUENCE
 REAL :: pos(2)
END TYPE
INTEGER, PARAMETER :: N=1000000
TYPE(point_type)     :: points(N)
REAL, DIMENSION(2*N) :: scratch
EQUIVALENCE(points,scratch)
CALL RANDOM_NUMBER(scratch)
scratch=2.0*scratch-1.0
count=0
DO i=1,N
  IF (SUM(points(i)%pos**2)<1.0) THEN
     count=count+1
  ENDIF
ENDDO
IF (4.0*REAL(count)/REAL(N).LT.3.14) THEN
    CALL ABORT
ENDIF
END


I believe you should reduce N in the testcase and allow a bigger error margin. For me this test takes 4/10 seconds. Given that every test is run 8 times this would mean a slowdown of the testsuite by two seconds. Not that this is dramatical, but it seems unnecessary.


With N=1000 I still get results which are well above 3, and the program runtime is dominated by startup time, i.e. they don't get shorter if I reduce N further.

- Tobi

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]