Le jeu. 12 déc. 2019 à 16:23, Alex Herbert <alex.d.herb...@gmail.com> a écrit :
>
>
> > OK. I'll remove ofReal() and ofImaginary().
> >
> > They can always be added later.
>
> The same may apply to square():
>
> public Complex square() {
>      return multiply(this);
> }

Sure.

>
> It could be defined differently:
>
> re = ac - bd = aa - bb = (a-b)(a+b)
> im = ad + bc = ab + ba = 2 ab
>
> public Complex square() {
>      return new Complex((real-imaginary)*(real+imaginary),
> 2*real*imaginary);
> }
>
> But this does not account for the overflow protection and handling of
> special cases done in multiply. So I'd rather leave it calling
> multiply(this). So the square() method seems redundant and I would
> recommend dropping it.

+1

>
> It was originally used in computations. Now it is not.

Thanks,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to