am 176e7108: am 838aa45b: Merge "fix [4026375] SensorManager quaternion functions can call sqrt with a negative number" into honeycomb-mr1

* commit '176e71081b17787652c778cd115e079199dac536':
  fix [4026375] SensorManager quaternion functions can call sqrt with a negative number
This commit is contained in:
Mathias Agopian
2011-03-09 14:36:05 -08:00
committed by Android Git Automerger

View File

@@ -2051,8 +2051,8 @@ public class SensorManager
if (rv.length == 4) {
Q[0] = rv[3];
} else {
//In this case, the w component of the quaternion is known to be a positive number
Q[0] = (float)Math.sqrt(1 - rv[0]*rv[0] - rv[1]*rv[1] - rv[2]*rv[2]);
Q[0] = 1 - rv[0]*rv[0] - rv[1]*rv[1] - rv[2]*rv[2];
Q[0] = (Q[0] > 0) ? (float)Math.sqrt(Q[0]) : 0;
}
Q[1] = rv[0];
Q[2] = rv[1];