commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arne Plöse (JIRA) <j...@apache.org>
Subject [jira] [Commented] (MATH-577) Enhance Complex.java
Date Tue, 19 Jul 2011 12:53:58 GMT

    [ https://issues.apache.org/jira/browse/MATH-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13067683#comment-13067683
] 

Arne Plöse commented on MATH-577:
---------------------------------

Should we file a bug against augend at Oracle ;-)?

No I choose addend, but summand sounds also fine.
 
{code}
    /**
     * Returns a {@code Complex} whose value is {@code (this +
     * addend)}.
     * <p>
     * Uses the definitional formula
     * <pre>
     * (a + bi) + (c + di) = (a+c) + (b+d)i
     * </pre></p>
     * <p>
     * If either {@code this} or {@code addend} has a {@code NaN} value in either part,
     * {@link #NaN} is returned; otherwise {@code Infinite} and {@code NaN} values are
     * returned in the parts of the result according to the rules for
     * {@link java.lang.Double} arithmetic.</p>
     *
     * @param  addend value to be added to this {@code Complex}.
     * @return {@code this + addend}
     * @throws NullArgumentException if {@code addend} is null
     */
    @Override
    public Complex add(Complex addend)
        throws NullArgumentException {
        MathUtils.checkNotNull(addend);
        if (isNaN || addend.isNaN) {
            return NaN;
        }
        return createComplex(real + addend.getReal(),
            imaginary + addend.getImaginary());
    }

    /**
     * Returns a {@code Complex} whose value is {@code (this +
     * addend)}.      
     * 
     * @param  addend value to be added to this {@code Complex}.
     * @return {@code this + addend}
     * @see #add(Complex)
     */
    public Complex add(double addend) {
        if (isNaN || Double.isNaN(addend)) {
            return NaN;
        }
        return createComplex(real + addend, imaginary);
    }

{code}

> Enhance Complex.java
> --------------------
>
>                 Key: MATH-577
>                 URL: https://issues.apache.org/jira/browse/MATH-577
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Arne Plöse
>            Priority: Minor
>         Attachments: Complex.diff, Complex.diff, Complex.diff
>
>
> Add some double shorthand methods to Complex fix different NaN checks in add and subtract
! Testcase  testAddNaN will fail (what should be the result ?)
> What is missing JavaDoc and testcases.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message