Quad: improve prevention of intermediate overflow in pow.