In Vector3f.divide() and Vector3f.divideLocal() the argument is first inverted 1/arg and then each component of the vector is multiplied by the inverted value.
Is float multiplication more efficient than float division?
public Vector3f divideLocal(float scalar) {
scalar = 1f/scalar;
x *= scalar;
y *= scalar;
z *= scalar;
return this;
}
Yes. On the Pentium III, it used to be 3 cycles latency for a multiply (and it could pipeline) versus 14 cycles for a divide (and it couldn't pipeline). I can only imaging it's not gotten better.