/** * Returns the inverse of this complex. <br> Inversion of a complex <code>a</code> returns complex <code>a<sup>-1</sup> = a' / |a|<sup>2</sup></code> where <code>a'</code> is {@link #conjugate() * conjugation} of <code>a</code>, and <code>|a|<sup>2</sup></code> is squared length of <code>a</code>. <br> For any complexes <code>a, b, c</code>, such that <code>a * b = c</code> equations * <code>a<sup>-1</sup> * c = b</code> and <code>c * b<sup>-1</sup> = a</code> are true. * * @return A new complex, which is the inverse of this one */ @Override public Complexf invert() { final float lengthSquared = lengthSquared(); if (Math.abs(lengthSquared) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot invert a complex of length zero"); } return conjugate().div(lengthSquared); }
/** * Returns the inverse of this complex. <br> Inversion of a complex <code>a</code> returns complex <code>a<sup>-1</sup> = a' / |a|<sup>2</sup></code> where <code>a'</code> is {@link #conjugate() * conjugation} of <code>a</code>, and <code>|a|<sup>2</sup></code> is squared length of <code>a</code>. <br> For any complexes <code>a, b, c</code>, such that <code>a * b = c</code> equations * <code>a<sup>-1</sup> * c = b</code> and <code>c * b<sup>-1</sup> = a</code> are true. * * @return A new complex, which is the inverse of this one */ @Override public Complexf invert() { final float lengthSquared = lengthSquared(); if (Math.abs(lengthSquared) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot invert a complex of length zero"); } return conjugate().div(lengthSquared); }