5 #include "util/u_math.h"
6 #include "util/u_half.h"
9 main(int argc, char **argv)
12 unsigned roundtrip_fails = 0;
13 for(i = 0; i < 1 << 16; ++i)
15 uint16_t h = (uint16_t) i;
18 f.ui = util_half_to_floatui(h);
19 rh = util_floatui_to_half(f.ui);
22 printf("Roundtrip failed: %x -> %x = %f -> %x\n", h, f.ui, f.f, rh);
28 printf("Failure! %u/65536 half floats failed a conversion to float and back.\n", roundtrip_fails);