#include "Halide.h"
#include <stdint.h>
#include <stdio.h>
#include <cmath>

using namespace Halide;

// FIXME: Why aren't we using a unit test framework for this?
// See Issue #898
void h_assert(bool condition, const char* msg) {
    if (!condition) {
        printf("FAIL: %s\n", msg);
        abort();
    }
}

int main() {
    // Number is larger than can be represented in half and won't be rounded
    // down to the largest representable value in half(65504).  but should be
    // representable in single precision
    const int32_t largeNum = 65536;

    // This should fail as it triggers overflow
    float16_t fail = float16_t::make_from_signed_int(largeNum, RoundingMode::ToNearestTiesToEven);

    // Supress -Wunused-but-set-variable
    fail.is_infinity();

    printf("Should not be reached!\n");
    return 0;
}

#include "Halide.h"
#include <stdint.h>
#include <stdio.h>
#include <cmath>

using namespace Halide;

// FIXME: Why aren't we using a unit test framework for this?
// See Issue #898
void h_assert(bool condition, const char* msg) {
    if (!condition) {
        printf("FAIL: %s\n", msg);
        abort();
    }
}

int main() {
    // Number is larger than can be represented in half and won't be rounded
    // down to the largest representable value in half(65504).  but should be
    // representable in single precision
    const int32_t largeNum = 65536;
    h_assert(!std::isnan(largeNum), "largeNum should not be NaN");
    h_assert(!std::isinf(largeNum), "largeNum should not be inf");

    // This should fail as it triggers overflow
    float16_t fail = float16_t::make_from_signed_int(largeNum, RoundingMode::ToNearestTiesToEven);

    // Supress -Wunused-but-set-variable
    fail.is_infinity();

    printf("Should not be reached!\n");
    return 0;
}

--- 
+++ 
@@ -19,8 +19,6 @@
     // down to the largest representable value in half(65504).  but should be
     // representable in single precision
     const int32_t largeNum = 65536;
-    h_assert(!std::isnan(largeNum), "largeNum should not be NaN");
-    h_assert(!std::isinf(largeNum), "largeNum should not be inf");
 
     // This should fail as it triggers overflow
     float16_t fail = float16_t::make_from_signed_int(largeNum, RoundingMode::ToNearestTiesToEven);
Remove isnan of an int


Former-commit-id: 863ff0257bd565c91499d2d66927223ad4c8fb69