[gfortran] patch for PR 15149 - problem computing PI

Bud Davis bdavis9659@comcast.net
Thu Apr 29 03:02:00 GMT 2004


On Wed, 2004-04-28 at 07:09, Paul Brook wrote:
   
> The comment on the test says we're testing for !=0, so doing that directly 
> would speed up the test significantly.
> 
 
since the PR concerns the random number generator being broken, vs. it's
quality, i propose this test:

! pr 15149
! verify the random number generator is functional
       IMPLICIT NONE
       INTEGER COUNT
       PARAMETER (COUNT=5)
       INTEGER I
       REAL R(COUNT),SUM
       DATA R / COUNT * 0.0 /
       CALL RANDOM_NUMBER(R)
       SUM = 0.0
       DO I=1,COUNT
          SUM = SUM + R(I)
       END DO
       IF (SUM.LE.0) CALL ABORT
       END

the other option is just
       
       REAL R
       DATA R / 0.0 /
       CALL RANDOM_NUMBER(R)
       IF (R.LE.0.0) CALL ABORT
       END

But it is OK for random to return 0.0, {not likely, i admit }. So, 5 0.0
values in a row is probably an indicator that a gross problem exists.


comments, gentlemen ?


--bud






More information about the Gcc-patches mailing list