@@ -203,7 +203,7 @@ subroutine CLARTG( f, g, c, s, r )
203203 rtmax = rtmax * 2
204204 if ( f2 > rtmin .and. h2 < rtmax ) then
205205 ! safmin <= sqrt( f2*h2 ) <= safmax
206- s = conjg ( g ) * ( f / sqrt ( f2 * h2 ) )
206+ s = ( f / sqrt ( f2 ) ) * ( conjg ( g ) / sqrt ( h2 ) )
207207 else
208208 s = conjg ( g ) * ( r / h2 )
209209 end if
@@ -223,7 +223,7 @@ subroutine CLARTG( f, g, c, s, r )
223223 ! sqrt(safmin) <= f2 * sqrt(safmax) <= h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax
224224 r = f * ( h2 / d )
225225 end if
226- s = conjg ( g ) * ( f / d )
226+ s = ( f / sqrt ( f2 ) ) * ( conjg ( g ) / sqrt ( h2 ) )
227227 end if
228228 else
229229!
@@ -259,7 +259,7 @@ subroutine CLARTG( f, g, c, s, r )
259259 rtmax = rtmax * 2
260260 if ( f2 > rtmin .and. h2 < rtmax ) then
261261 ! safmin <= sqrt( f2*h2 ) <= safmax
262- s = conjg ( gs ) * ( fs / sqrt ( f2 * h2 ) )
262+ s = ( fs / sqrt ( f2 ) ) * ( conjg ( gs ) / sqrt ( h2 ) )
263263 else
264264 s = conjg ( gs ) * ( r / h2 )
265265 end if
@@ -279,7 +279,7 @@ subroutine CLARTG( f, g, c, s, r )
279279 ! sqrt(safmin) <= f2 * sqrt(safmax) <= h2 / sqrt(f2 * h2) <= h2 * (safmin / f2) <= h2 <= safmax
280280 r = fs * ( h2 / d )
281281 end if
282- s = conjg ( gs ) * ( fs / d )
282+ s = ( fs / sqrt ( f2 ) ) * ( conjg ( gs ) / sqrt ( h2 ) )
283283 end if
284284 ! Rescale c and r
285285 c = c * w
0 commit comments