mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Make bfloat16(float(-nan)) produce -nan, not nan.
This commit is contained in:
@@ -230,6 +230,17 @@ void test_conversion()
|
||||
VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0xffc0))));
|
||||
VERIFY((numext::isinf)(bfloat16(__bfloat16_raw(0x7f80))));
|
||||
VERIFY((numext::isnan)(bfloat16(__bfloat16_raw(0x7fc0))));
|
||||
|
||||
VERIFY_IS_EQUAL(bfloat16(BinaryToFloat(0x0, 0xff, 0x40, 0x0)).value, 0x7fc0);
|
||||
VERIFY_IS_EQUAL(bfloat16(BinaryToFloat(0x1, 0xff, 0x40, 0x0)).value, 0xffc0);
|
||||
VERIFY_IS_EQUAL(Eigen::bfloat16_impl::truncate_to_bfloat16(
|
||||
BinaryToFloat(0x0, 0xff, 0x40, 0x0))
|
||||
.value,
|
||||
0x7fc0);
|
||||
VERIFY_IS_EQUAL(Eigen::bfloat16_impl::truncate_to_bfloat16(
|
||||
BinaryToFloat(0x1, 0xff, 0x40, 0x0))
|
||||
.value,
|
||||
0xffc0);
|
||||
}
|
||||
|
||||
void test_numtraits()
|
||||
|
||||
Reference in New Issue
Block a user