Hardcoding numeric_limits values to work on platforms where our float16 class isn't defined
This commit is contained in:
@@ -32,9 +32,27 @@ TEST_CASE("Basic Conversions", "[float16]")
|
||||
|
||||
TEST_CASE("Infinity and NaN", "[float16]")
|
||||
{
|
||||
fp16 pos_inf = std::numeric_limits<fp16>::infinity();
|
||||
fp16 neg_inf = -std::numeric_limits<fp16>::infinity();
|
||||
|
||||
fp16 min_val = std::numeric_limits<fp16>::min();
|
||||
fp16 max_val = std::numeric_limits<fp16>::max();
|
||||
fp16 epsilon_val = std::numeric_limits<fp16>::epsilon();
|
||||
fp16 round_err_val = std::numeric_limits<fp16>::round_error();
|
||||
fp16 denorm_min = std::numeric_limits<fp16>::denorm_min();
|
||||
fp16 pos_inf = std::numeric_limits<fp16>::infinity();
|
||||
fp16 nan_val = std::numeric_limits<fp16>::quiet_NaN();
|
||||
fp16 snan_val = std::numeric_limits<fp16>::signaling_NaN();
|
||||
|
||||
INFO("Value of 16 min: " << std::hex << *(uint16_t *)&min_val);
|
||||
INFO("Value of 16 max: " << std::hex << *(uint16_t *)&max_val);
|
||||
INFO("Value of 16 epsilon: " << std::hex << *(uint16_t *)&epsilon_val);
|
||||
INFO("Value of 16 round_error: " << std::hex << *(uint16_t *)&round_err_val);
|
||||
|
||||
INFO("Value of 16 denorm_min: " << std::hex << *(uint16_t *)&denorm_min);
|
||||
INFO("Value of 16 pos_inf: " << std::hex << *(uint16_t *)&pos_inf);
|
||||
INFO("Value of 16 neg_inf: " << std::hex << *(uint16_t *)&neg_inf);
|
||||
INFO("Value of 16 nan: " << std::hex << *(uint16_t *)&nan_val);
|
||||
INFO("Value of 16 snan: " << std::hex << *(uint16_t *)&snan_val);
|
||||
|
||||
INFO("Value of pos_inf: " << static_cast<float>(pos_inf));
|
||||
INFO("Value of neg_inf: " << static_cast<float>(neg_inf));
|
||||
|
||||
Reference in New Issue
Block a user