14 #define VERIFY_HALF_BITS_EQUAL(h, bits) \
15 VERIFY_IS_EQUAL((numext::bit_cast<numext::uint16_t>(h)), (static_cast<numext::uint16_t>(bits)))
30 numext::bit_cast<half>(numext::bit_cast<numext::uint16_t>(
half(1.0
f))),
33 numext::bit_cast<half>(numext::bit_cast<numext::uint16_t>(
half(0.5
f))),
36 numext::bit_cast<half>(numext::bit_cast<numext::uint16_t>(
half(-0.33333
f))),
39 numext::bit_cast<half>(numext::bit_cast<numext::uint16_t>(
half(0.0
f))),
57 float val1 =
float(
half(__half_raw(0x3c00)));
58 float val2 =
float(
half(__half_raw(0x3c01)));
59 float val3 =
float(
half(__half_raw(0x3c02)));
116 VERIFY(
static_cast<bool>(
half(__half_raw(0x7bff))));
129 std::cout <<
"denorm min = " << (std::numeric_limits<half>::denorm_min)() <<
" (0x" << std::hex << numext::bit_cast<numext::uint16_t>(
half((std::numeric_limits<half>::denorm_min)())) <<
")" << std::endl;
132 std::cout <<
"signaling nan = " << std::numeric_limits<half>::signaling_NaN() <<
" (0x" << std::hex << numext::bit_cast<numext::uint16_t>(std::numeric_limits<half>::signaling_NaN()) <<
")" << std::endl;
137 numext::bit_cast<numext::uint16_t>(std::numeric_limits<half>::infinity()),
138 numext::bit_cast<numext::uint16_t>(
half(std::numeric_limits<float>::infinity())) );
146 && ((numext::bit_cast<numext::uint16_t>(std::numeric_limits<half>::quiet_NaN()) & HALF_QUIET_BIT) > 0)
147 && ((numext::bit_cast<numext::uint16_t>(
half(std::numeric_limits<float>::quiet_NaN())) & HALF_QUIET_BIT) > 0) );
154 && ((numext::bit_cast<numext::uint16_t>(std::numeric_limits<half>::signaling_NaN()) & HALF_QUIET_BIT) == 0) );
157 VERIFY( (std::numeric_limits<half>::denorm_min)() >
half(0.
f) );
305 Index size = internal::random<Index>(1,10);
307 ArrayXh
a1 = ArrayXh::Random(
size),
a2 = ArrayXh::Random(
size);
318 std::stringstream
ss;
328 MatrixXh Ah = MatrixXh::Random(
rows,
depth);
329 MatrixXh Bh = MatrixXh::Random(
depth,
cols);
330 MatrixXh Ch = MatrixXh::Random(
rows,
cols);
331 MatrixXf Af = Ah.cast<
float>();
332 MatrixXf Bf = Bh.cast<
float>();
333 MatrixXf Cf = Ch.cast<
float>();