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

Raymond DeCampo commented on NUMBERS-22:
----------------------------------------

The argument for using {{Complex.INF}} is that then you end up with the Riemann 
sphere, aka stereographic projection of the sphere onto the complex plane.

The alternate is to have eight infinities: (±Inf, 0), (0, ±Inf) and (±Inf, 
±Inf).  (In case whatever you are reading this comment with is mangling it, 
that symbol is plus/minus.)  There are probably other alternatives that escape 
my imagination.

Eric Barnhill recently undertook an effort to make the Complex implementation 
conform to IEEE and/or C99 standards, perhaps we should wait for his input.

> Method reciprocal() in Complex for complex numbers with parts very close to 
> 0.0
> -------------------------------------------------------------------------------
>
>                 Key: NUMBERS-22
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-22
>             Project: Commons Numbers
>          Issue Type: Improvement
>            Reporter: Gunel Jahangirova
>            Priority: Minor
>
> I have been redirected here from the issue repository of Apache Commons Math, 
> as the Complex class will likely be deprecated in favour of its equivalent in 
> "Commons Numbers".
> In class Complex method reciprocal() returns INF only if the real and 
> imaginary parts are exactly equal to 0.0. In the cases when real and 
> imaginary parts are double numbers very close to 0.0, it does not hold. For 
> example, if we run this code
> {code}
> Complex complex0 = new Complex((-2.44242319E-315));
> Complex complex1 = complex0.reciprocal();
> {code}
> the value of complex1.getReal() will be -Infinity and the value of 
> complex1.getImaginary() will be NaN, instead of complex1 being equal to INF.
> The suggested solutions after the discussion are either checking the equality 
> to ZERO with some tolerance or to detect if one of the real or imaginary 
> parts is going to be infinite or NaN and then return the proper result. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to