The user supplied signs of the imaginary parts are only relevant for x real
and positive. A negative sign in the case of x real and negative is irrelevant
(there is no branch cut) and led to wrong results. This is now avoided.
all_zero = false;
}
if ( ex_to<numeric>(*itx).is_real() ) {
- if ( *its >= 0 ) {
+ if ( ex_to<numeric>(*itx).is_positive() ) {
+ if ( *its >= 0 ) {
+ sn.push_back(1);
+ }
+ else {
+ sn.push_back(-1);
+ }
+ } else {
sn.push_back(1);
}
- else {
- sn.push_back(-1);
- }
}
else {
if ( ex_to<numeric>(*itx).imag() > 0 ) {
all_zero = false;
}
if ( ex_to<numeric>(*itx).is_real() ) {
- if ( *its >= 0 ) {
+ if ( ex_to<numeric>(*itx).is_positive() ) {
+ if ( *its >= 0 ) {
+ sn.push_back(1);
+ }
+ else {
+ sn.push_back(-1);
+ }
+ } else {
sn.push_back(1);
}
- else {
- sn.push_back(-1);
- }
}
else {
if ( ex_to<numeric>(*itx).imag() > 0 ) {