A variation of Paige's algorithm is presented for computing the genera
lized singular value decomposition (GSVD) of two matrices A and B. The
re are two innovations. The first is a new preprocessing step which re
duces A and B to upper triangular forms satisfying certain rank condit
ions. The second is a new 2 x 2 triangular GSVD algorithm, which const
itutes the inner loop of Paige's algorithm. Proofs of stability and hi
gh accuracy of the 2 x 2 GSVD algorithm are presented and are demonstr
ated using examples on which all previous algorithms fail.