You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Raymond DeCampo <ra...@decampo.org> on 2017/01/03 14:43:26 UTC

[math] (MATH-1397) Complex.ZERO.pow(2.0) is NaN

I could probably find some time to help out moving the complex number
library out of math and into complex.

I was going to start by generating a pull request for this fix.  I found
the apache/commons-complex on github however it is currently empty so I
imagine there is something more fundamental that needs to be done first (or
perhaps I am looking in the wrong place).  I did also find the git
repository on git-wip-us.apache.org but the tree view gives a 404 (
https://git-wip-us.apache.org/repos/asf?p=commons-complex.git;a=tree).

Let me know how I can help.

Thanks,
Ray

---------- Forwarded message ----------
From: Gilles (JIRA) <ji...@apache.org>
Date: Mon, Jan 2, 2017 at 6:31 PM
Subject: [jira] [Commented] (MATH-1397) Complex.ZERO.pow(2.0) is NaN
To: ray@decampo.org



    [ https://issues.apache.org/jira/browse/MATH-1397?page=com.
atlassian.jira.plugin.system.issuetabpanels:comment-tabpane
l&focusedCommentId=15793695#comment-15793695 ]

Gilles commented on MATH-1397:
------------------------------

Hello Mario and Raymond.

Having complex numbers (and related functionality) in their own component
was on the roadmap; an effort led by Eric Barnhill (to whom I've just
assigned this issue).
If you'd like to help move the code out of Commons Math, please post to the
"dev" ML.

Thanks for the report.


> Complex.ZERO.pow(2.0) is NaN
> ----------------------------
>
>                 Key: MATH-1397
>                 URL: https://issues.apache.org/jira/browse/MATH-1397
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>         Environment: Linux, Java1.7/Java1.8
>            Reporter: Mario Wenzel
>            Assignee: Eric Barnhill
>            Priority: Minor
>
> ```
> package complextest;
> import org.apache.commons.math3.complex.Complex;
> public class T {
>       public static void main(String[] args) {
>               System.out.println(Complex.ZERO.pow(2.0));
>       }
> }
> ```
> This is the code and the readout is `(NaN, NaN)`. This surely isn't
right. For one, it should actually be zero (https://www.wolframalpha.com/
input/?i=(0%2B0i)%5E2) and second of all, the documentation doesn't state
that anything could go wrong from a Complex number that has no NaNs and
Infs.
> The other definition states that it doesn't work when the base is Zero,
but it surely should. This strange corner case destroys any naive
implementation of stuff wrt the mandelbrot set.
> It would be nice to not have to implement this exception myself.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Re: [math] (MATH-1397) Complex.ZERO.pow(2.0) is NaN

Posted by Eric Barnhill <er...@gmail.com>.
Hi Ray,

I have been working on commons-complex but unfortunately have not been
moving as fast as I should. It is actually about ready I have just not
pushed it yet. Let me get the base code up this week, then it will be easy
for you to push changes to it.

Best,
Eric



On Tue, Jan 3, 2017 at 3:43 PM, Raymond DeCampo <ra...@decampo.org> wrote:

> I could probably find some time to help out moving the complex number
> library out of math and into complex.
>
> I was going to start by generating a pull request for this fix.  I found
> the apache/commons-complex on github however it is currently empty so I
> imagine there is something more fundamental that needs to be done first (or
> perhaps I am looking in the wrong place).  I did also find the git
> repository on git-wip-us.apache.org but the tree view gives a 404 (
> https://git-wip-us.apache.org/repos/asf?p=commons-complex.git;a=tree).
>
> Let me know how I can help.
>
> Thanks,
> Ray
>
> ---------- Forwarded message ----------
> From: Gilles (JIRA) <ji...@apache.org>
> Date: Mon, Jan 2, 2017 at 6:31 PM
> Subject: [jira] [Commented] (MATH-1397) Complex.ZERO.pow(2.0) is NaN
> To: ray@decampo.org
>
>
>
>     [ https://issues.apache.org/jira/browse/MATH-1397?page=com.
> atlassian.jira.plugin.system.issuetabpanels:comment-tabpane
> l&focusedCommentId=15793695#comment-15793695 ]
>
> Gilles commented on MATH-1397:
> ------------------------------
>
> Hello Mario and Raymond.
>
> Having complex numbers (and related functionality) in their own component
> was on the roadmap; an effort led by Eric Barnhill (to whom I've just
> assigned this issue).
> If you'd like to help move the code out of Commons Math, please post to the
> "dev" ML.
>
> Thanks for the report.
>
>
> > Complex.ZERO.pow(2.0) is NaN
> > ----------------------------
> >
> >                 Key: MATH-1397
> >                 URL: https://issues.apache.org/jira/browse/MATH-1397
> >             Project: Commons Math
> >          Issue Type: Bug
> >    Affects Versions: 3.6.1
> >         Environment: Linux, Java1.7/Java1.8
> >            Reporter: Mario Wenzel
> >            Assignee: Eric Barnhill
> >            Priority: Minor
> >
> > ```
> > package complextest;
> > import org.apache.commons.math3.complex.Complex;
> > public class T {
> >       public static void main(String[] args) {
> >               System.out.println(Complex.ZERO.pow(2.0));
> >       }
> > }
> > ```
> > This is the code and the readout is `(NaN, NaN)`. This surely isn't
> right. For one, it should actually be zero (https://www.wolframalpha.com/
> input/?i=(0%2B0i)%5E2) and second of all, the documentation doesn't state
> that anything could go wrong from a Complex number that has no NaNs and
> Infs.
> > The other definition states that it doesn't work when the base is Zero,
> but it surely should. This strange corner case destroys any naive
> implementation of stuff wrt the mandelbrot set.
> > It would be nice to not have to implement this exception myself.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>