Mantis - ALGLIB
Viewing Issue Advanced Details
332 General major have not tried 2010-05-18 19:47 2010-05-26 12:34
artyomstv  
SergeyB  
normal  
resolved  
fixed  
none    
none 2.6.0  
C++
0000332: FIXED: Mistake in C++ implementation of ap::complex::operator/=(complex& z)
Wrong code:

if( fabs(z.y)<fabs(z.x) ){
    e = z.y/z.x;
    f = z.x+z.y*e;
    result.x = (z.x+z.y*e)/f;
    result.y = (z.y-z.x*e)/f;
} else {
    e = z.x/z.y;
    f = z.y+z.x*e;
    result.x = (z.y+z.x*e)/f;
    result.y = (-z.x+z.y*e)/f;
}

Correct code:

if( fabs(z.y)<fabs(z.x) ){
    e = z.y/z.x;
    f = z.x+z.y*e;
    result.x = (x+y*e)/f;
    result.y = (y-x*e)/f;
} else {
    e = z.x/z.y;
    f = z.y+z.x*e;
    result.x = (y+x*e)/f;
    result.y = (y*e-x)/f;
}
Have not checked any other operators. Maybe it is neccessary to check them.
Issue History
2010-05-18 19:47 artyomstv New Issue
2010-05-18 19:47 artyomstv Programming language => C++
2010-05-19 08:36 SergeyB Status new => assigned
2010-05-19 08:36 SergeyB Assigned To => SergeyB
2010-05-19 08:38 SergeyB Note Added: 0000050
2010-05-19 08:38 SergeyB Status assigned => resolved
2010-05-19 08:38 SergeyB Fixed in Version => [NOT RELEASED YET] Next release
2010-05-19 08:38 SergeyB Resolution open => fixed
2010-05-26 12:34 SergeyB Category AlgoPascal => General
2010-05-26 12:34 SergeyB Summary Mistake in C++ implementation of ap::complex::operator/=(complex& z) => FIXED: Mistake in C++ implementation of ap::complex::operator/=(complex& z)

Notes
(0000050)
SergeyB   
2010-05-19 08:38   
Fixed.

Thanks for your bug report!