add proper mag_sqrt and mag_rsqrt