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


On Thursday 29 April 2004 02:32, Bud Davis wrote:
> 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

Possibly a better (simpler) way of writing this would be:

! pr 15149
! verify the random number generator is functional
program test_random
  implicit none
  real :: r(5) = 0.0

  call random_number(r)
  if (all (r .eq. 0)) call abort
end program

Please apply the patch and testcase.

Paul


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