This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Who's the m4 guru?


Gang,

We have PR 28452 that contains this code:

  real*10 x
  call random_number (x)
  end program rand10

Currently, random_number only handles real(4) and real(8).
I'm looking for an m4 guru (hi, Thomas and FX :-) who can
implement essentially

    subroutine random_number_r10(x)  ! _gfortran_random_number_r10
       implicit none
       real(10), intent(out) :: x
       real(8) a
       call random_number(a)
       x = a
    end subroutine random_number_r10

    subroutine arandom_number_r10(x)  ! _gfortran_arandom_number_r10
       implicit none                  ! I'm not sure if this is the
       real(10), intent(out) :: x(*)  ! right way to do this.
       real(8) a(size(x))
       call random_number(a)
       x = a
    end subroutine random_number_r10

We also need REAL(16) for those targets that support this kind.
I vow to someday learn m4.

BTW, we want to wrap the REAL(8) version for REAL(10) and REAL(16)
types because for a given seed gfortran will return essentially
the same sequence for REAL(4) and REAL(8).  That is, the 24-bits
of the REAL(4) are identical to the 24 most significant bits
of the REAL(8) and the remaining 29 bits are also random.

-- 
Steve


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