101 DOUBLE PRECISION CS, F, G, R, SN
107 DOUBLE PRECISION ZERO
108 parameter( zero = 0.0d0 )
110 parameter( one = 1.0d0 )
112 parameter( two = 2.0d0 )
117 DOUBLE PRECISION EPS, F1, G1, SAFMIN, SAFMN2, SAFMX2, SCALE
120 DOUBLE PRECISION DLAMCH
124 INTRINSIC abs, int, log, max, sign, sqrt
135 safmin = dlamch(
'S' )
137 safmn2 = dlamch(
'B' )**int( log( safmin / eps ) /
138 $ log( dlamch(
'B' ) ) / two )
139 safmx2 = one / safmn2
146 ELSE IF( f.EQ.zero )
THEN
153 scale = max( abs( f1 ), abs( g1 ) )
154 IF( scale.GE.safmx2 )
THEN
160 scale = max( abs( f1 ), abs( g1 ) )
161 IF( scale.GE.safmx2 .AND. count .LT. 20 )
163 r = sqrt( f1**2+g1**2 )
169 ELSE IF( scale.LE.safmn2 )
THEN
175 scale = max( abs( f1 ), abs( g1 ) )
176 IF( scale.LE.safmn2 )
178 r = sqrt( f1**2+g1**2 )
185 r = sqrt( f1**2+g1**2 )
subroutine dlartgp(f, g, cs, sn, r)
DLARTGP generates a plane rotation so that the diagonal is nonnegative.