| 529 | } |
| 530 | |
| 531 | inline int HalfForCompare(const half h) |
| 532 | { |
| 533 | // Map neg 0 and pos 0 to 32768, allowing tolerance-based comparison |
| 534 | // of small numbers of mixed sign. |
| 535 | const int rawHalf = h.bits(); |
| 536 | return rawHalf < 32767 ? rawHalf + 32768 : 2 * 32768 - rawHalf; |
| 537 | } |
| 538 | |
| 539 | bool HalfsDiffer(const half expected, const half actual, const int tolerance) |
| 540 | { |