      SUBROUTINE SROTG( SA, SB, C, S )
****************************************************************************
*                                                                          *
*   DATA PARALLEL BLAS based on MPL                                        *
*                                                                          *
*   Version 1.0   1/9-92 ,                                                 *
*   For MasPar MP-1 computers                                              *
*                                                                          *
*   para//ab, University of Bergen, NORWAY                                 *
*                                                                          *
*   These programs must be called using F90 style array syntax.            *
*   Note that the F77 style calling sequence has been retained             *
*   in this version for compatibility reasons, be aware that               *
*   parameters related to the array dimensions and shape therefore may     *
*   be redundant and without any influence.                                *
*   The calling sequence may be changed in a future version.               *
*   Please report any BUGs, ideas for improvement or other                 *
*   comments to                                                            *
*                    adm@parallab.uib.no                                   *
*                                                                          *
*   Future versions may then reflect your suggestions.                     *
*   The most current version of this software is available                 *
*   from netlib@nac.no , send the message `send index from maspar'         *
*                                                                          *
*   REVISIONS:                                                             *
*                                                                          *
****************************************************************************
      implicit none
*
*     construct givens plane rotation.
*     jack dongarra, linpack, 3/11/78.
*                    modified 9/27/86.
*
*     .. Scalar Arguments ..
      REAL  C, S, SA, SB
*     ..
*     .. Local Scalars ..
      REAL  R, ROE, SCALE, Z
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC         ABS, SIGN, SQRT
*     ..
*     .. Executable Statements ..
*
      ROE = SB
      IF( ABS( SA ).GT.ABS( SB ) )
     $   ROE = SA
      SCALE = ABS( SA ) + ABS( SB )
      IF( SCALE.NE.0.d0 )
     $   GO TO 10
      C = 1.d0
      S = 0.d0
      R = 0.d0
      GO TO 20
   10 R = SCALE*SQRT( ( SA / SCALE )**2+( SB / SCALE )**2 )
      R = SIGN( 1.d0, ROE )*R
      C = SA / R
      S = SB / R
   20 Z = S
      IF( ABS( C ).GT.0.d0 .AND. ABS( C ).LE.S )
     $   Z = 1.d0 / C
      SA = R
      SB = Z
*
      RETURN
*
*     End of SROTG .
*
      END