commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] Updated: (MATH-306) Method 'divide' in class 'Complex' uses a false formula for a special case resulting in erroneous division by zero.
Date Wed, 14 Apr 2010 00:05:59 GMT

     [ https://issues.apache.org/jira/browse/MATH-306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Phil Steitz updated MATH-306:
-----------------------------

        Fix Version/s: 2.1
    Affects Version/s: 2.0
                       1.2
                       1.1

> Method 'divide' in class 'Complex' uses a false formula for a special case resulting
in erroneous division by zero.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: MATH-306
>                 URL: https://issues.apache.org/jira/browse/MATH-306
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.2, 2.0
>         Environment: all
>            Reporter: Joerg Huber
>             Fix For: 2.1
>
>
> The formula that 'divide' wants to implement is
> ( a + bi )  /  ( c + di )  =  ( ac + bd + ( bc - ad ) i )  /  ( c^2 + d^2 )
> as correctly written in the description.
> When c == 0.0 this leads to the special case
> ( a + bi )  /  di  = ( b / d ) - ( a / d ) i
> But the corresponding code is:
> if (c == 0.0) {
>     return createComplex(imaginary/d, -real/c);
> }
> The bug is the last division -real/c, which should obviously be -real/d.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message