Fixed numerical instability in cross-product function