| 88 | } |
| 89 | |
| 90 | TEST(Float16FromFloatTest, HandlesSignedZerosAndInfinities) { |
| 91 | const uint16_t positive_zero = convert_bits(0.0f); |
| 92 | const uint16_t negative_zero = convert_bits(-0.0f); |
| 93 | EXPECT_HALF_EQ(positive_zero, 0x0000); |
| 94 | EXPECT_HALF_EQ(negative_zero, 0x8000); |
| 95 | EXPECT_HALF_EQ(static_cast<uint16_t>(positive_zero & 0x7FFF), 0x0000); |
| 96 | EXPECT_HALF_EQ(static_cast<uint16_t>(negative_zero & 0x7FFF), 0x0000); |
| 97 | |
| 98 | EXPECT_HALF_EQ(convert_bits(std::numeric_limits<float>::infinity()), 0x7C00); |
| 99 | EXPECT_HALF_EQ(convert_bits(-std::numeric_limits<float>::infinity()), 0xFC00); |
| 100 | } |
| 101 | |
| 102 | TEST(Float16FromFloatTest, PreservesNaNPayloadAndQuietsSignalingNaNs) { |
| 103 | struct Case { |
nothing calls this directly
no test coverage detected