isnan() returns unexpected result for std::complex

Issue #337 resolved
Tim Zimmermann created an issue

Hi,

consider this minimal example( tested with gcc 9 and clang 9):

#include <blaze/math/DynamicVector.h>
#include <iostream>
#include <limits>

int main(void) {
    blaze::DynamicVector<double> v(1);
    v[0] = std::numeric_limits<double>::quiet_NaN();
    // 1
    std::cout << blaze::isnan(v) << std::endl;

    blaze::DynamicVector<std::complex<double>> w(1);
    w[0] = std::complex<double>(std::numeric_limits<double>::quiet_NaN(),
                                std::numeric_limits<double>::quiet_NaN());
    // 0
    std::cout << blaze::isnan(w) << std::endl;

    return 0;
}

Is isnan() expected to work with std::complex<double>? I believe according to the documentation it should work.

Tim

Comments (4)

  1. Klaus Iglberger

    Hi Tim!

    Thanks for reporting this defect. You are correct, the isnan() function for dense vectors does not work as expected. Unfortunately this error was introduced six days ago with commit decc12c and our tests didn’t catch this. We apologize for the inconvenience and will fix the bug as quickly as possible. Thanks again,

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit d23a7bc fixes the isnan(), isinf() and infinite() functions for vectors and matrices. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.8.

  3. Log in to comment