113 COMPLEX*16 f, g, r, sn
119 DOUBLE PRECISION two, one, zero
120 parameter( two = 2.0d+0, one = 1.0d+0, zero = 0.0d+0 )
122 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
127 DOUBLE PRECISION d, di, dr, eps, f2, f2s, g2, g2s, safmin,
128 $ safmn2, safmx2, scale
129 COMPLEX*16 ff, fs, gs
136 INTRINSIC abs, dble, dcmplx, dconjg, dimag, int, log,
140 DOUBLE PRECISION abs1, abssq
149 abs1( ff ) = max( abs( dble( ff ) ), abs( dimag( ff ) ) )
150 abssq( ff ) = dble( ff )**2 + dimag( ff )**2
157 safmn2 =
dlamch(
'B' )**int( log( safmin / eps ) /
158 $ log(
dlamch(
'B' ) ) / two )
159 safmx2 = one / safmn2
162 scale = max( abs1( f ), abs1( g ) )
166 IF( scale.GE.safmx2 )
THEN
172 IF( scale.GE.safmx2 )
174 ELSE IF( scale.LE.safmn2 )
THEN
175 IF( g.EQ.czero )
THEN
186 IF( scale.LE.safmn2 )
191 IF( f2.LE.max( g2, one )*safmin )
THEN
195 IF( f.EQ.czero )
THEN
197 r =
dlapy2( dble( g ), dimag( g ) )
199 d =
dlapy2( dble( gs ), dimag( gs ) )
200 sn = dcmplx( dble( gs ) / d, -dimag( gs ) / d )
203 f2s =
dlapy2( dble( fs ), dimag( fs ) )
217 IF( abs1( f ).GT.one )
THEN
218 d =
dlapy2( dble( f ), dimag( f ) )
219 ff = dcmplx( dble( f ) / d, dimag( f ) / d )
221 dr = safmx2*dble( f )
222 di = safmx2*dimag( f )
224 ff = dcmplx( dr / d, di / d )
226 sn = ff*dcmplx( dble( gs ) / g2s, -dimag( gs ) / g2s )
234 f2s = sqrt( one+g2 / f2 )
236 r = dcmplx( f2s*dble( fs ), f2s*dimag( fs ) )
240 sn = dcmplx( dble( r ) / d, dimag( r ) / d )
242 IF( count.NE.0 )
THEN
243 IF( count.GT.0 )
THEN