about Conversion Matrix to Quaternion

absQ2 = det( matrix )^(1/3)

quaternion.w = sqrt( max( 0, absQ2 + m00 + m11 + m22 ) ) / 2;

How to write det ()?

The formula for getting the determinant of a 4-by-4 matrix can be found here:
http://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/fourD/index.htm

Thank you for your reply. .
But when the scale is greater than 1, use the following formula or wrong.

Some people know Scale, is not equal to 1, the matrix can also be converted to the quat right way?

public static void TransformFromMatrix(Matrix4x4 matrix, Transform trans) {
		
	    trans.localPosition = matrix.GetColumn(3);// uses implicit conversion from Vector4 to Vector3
		trans.localRotation  = QuaternionFromMatrix(matrix);
		trans.localScale = new Vector3(matrix.GetColumn(0).magnitude,matrix.GetColumn(1).magnitude,matrix.GetColumn(2).magnitude);

	}

	public static Quaternion QuaternionFromMatrix(Matrix4x4 m) {

	    Quaternion q = new Quaternion();
	    float absQ2 = Mathf.Pow(determinant( m ),(1/3));
	    q.w = Mathf.Sqrt( Mathf.Max( 0, absQ2 + m[0,0] + m[1,1] + m[2,2] ) ) / 2; 
	    q.x = Mathf.Sqrt( Mathf.Max( 0, 1 + m[0,0] - m[1,1] - m[2,2] ) ) / 2; 
	    q.y = Mathf.Sqrt( Mathf.Max( 0, 1 - m[0,0] + m[1,1] - m[2,2] ) ) / 2; 
	    q.z = Mathf.Sqrt( Mathf.Max( 0, 1 - m[0,0] - m[1,1] + m[2,2] ) ) / 2; 
	    q.x *= Mathf.Sign( q.x * ( m[2,1] - m[1,2] ) );
	    q.y *= Mathf.Sign( q.y * ( m[0,2] - m[2,0] ) );
	    q.z *= Mathf.Sign( q.z * ( m[1,0] - m[0,1] ) );
		
	    return q;
	}
	
	public static float determinant(Matrix4x4 m) {
      float tmp;
      tmp =
      m.m03 * m.m12 * m.m21 * m.m30-m.m02 * m.m13 * m.m21 * m.m30-m.m03 * m.m11 * m.m22 * m.m30+m.m01 * m.m13 * m.m22 * m.m30+
      m.m02 * m.m11 * m.m23 * m.m30-m.m01 * m.m12 * m.m23 * m.m30-m.m03 * m.m12 * m.m20 * m.m31+m.m02 * m.m13 * m.m20 * m.m31+
      m.m03 * m.m10 * m.m22 * m.m31-m.m00 * m.m13 * m.m22 * m.m31-m.m02 * m.m10 * m.m23 * m.m31+m.m00 * m.m12 * m.m23 * m.m31+
      m.m03 * m.m11 * m.m20 * m.m32-m.m01 * m.m13 * m.m20 * m.m32-m.m03 * m.m10 * m.m21 * m.m32+m.m00 * m.m13 * m.m21 * m.m32+
      m.m01 * m.m10 * m.m23 * m.m32-m.m00 * m.m11 * m.m23 * m.m32-m.m02 * m.m11 * m.m20 * m.m33+m.m01 * m.m12 * m.m20 * m.m33+
      m.m02 * m.m10 * m.m21 * m.m33-m.m00 * m.m12 * m.m21 * m.m33-m.m01 * m.m10 * m.m22 * m.m33+m.m00 * m.m11 * m.m22 * m.m33;
	return tmp;
   }