2019-12-08 2:00 UTC+01:00, aherb...@apache.org <aherb...@apache.org>: > This is an automated email from the ASF dual-hosted git repository. > > aherbert pushed a commit to branch master > in repository https://gitbox.apache.org/repos/asf/commons-numbers.git > > commit 65f60835e2afe26bdaba9665d62edb25195bfff6 > Author: Alex Herbert <aherb...@apache.org> > AuthorDate: Sun Dec 8 00:54:03 2019 +0000 > > Added getAbsolute() to complement getArgument().
Is that name part of the reference? If not, "getMagnitude" or "getModulus" would be clearer. Gilles > --- > .../apache/commons/numbers/complex/Complex.java | 33 > ++++++++++++++++++---- > .../commons/numbers/complex/ComplexTest.java | 22 +++++++++------ > 2 files changed, 41 insertions(+), 14 deletions(-) > > diff --git > a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > index bbee805..92f4c2a 100644 > --- > a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > +++ > b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > @@ -284,13 +284,33 @@ public final class Complex implements Serializable { > return this; > } > > - /** > - * Return the absolute value of this complex number. > - * This code follows the <a > href="http://www.iso-9899.info/wiki/The_Standard">ISO C Standard</a>, Annex > G, > - * in calculating the returned value (i.e. the hypot(x,y) method) > - * and in handling of NaNs. > + /** > + * Return the absolute value of this complex number. This is also > called norm, modulus, > + * or magnitude. > + * <pre>abs(a + b i) = sqrt(a^2 + b^2)</pre> > + * > + * <p>If either component is infinite then the result is positive > infinity. If either > + * component is NaN and this is not {@link #isInfinite() infinite} then > the result is NaN. > + * > + * <p>This code follows the > + * <a href="http://www.iso-9899.info/wiki/The_Standard">ISO C > Standard</a>, Annex G, > + * in calculating the returned value using the {@code hypot(x,y)} > method. > * > * @return the absolute value. > + * @see #isInfinite() > + * @see #isNaN() > + * @see Math#hypot(double, double) > + */ > + public double getAbsolute() { > + return getAbsolute(real, imaginary); > + } > + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org