Skip to content

Commit 0e98817

Browse files
authored
libclc: frexp: fix implementation regarding denormals (#134823)
Devices not supporting denormals can compare them true against zero. It leads to result not matching the CTS expectation when either supporting or not denormals. For example for 0x1.008p-140 we get {0x1.008p-140, 0} while the CTS expects {0x1.008p-1, -139} when supporting denormals, or {0, 0} when not supporting denormals (flushed to zero). Ref #129871
1 parent 3a6b9b3 commit 0e98817

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libclc/clc/lib/generic/math/clc_frexp.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ __clc_frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) {
2626
(ai & (__CLC_INTN)MANTBITS_SP32);
2727

2828
__CLC_INTN is_inf_nan_or_zero =
29-
x == __CLC_FP_LIT(0.0) || __clc_isinf(x) || __clc_isnan(x);
29+
ai == (__CLC_INTN)0 || __clc_isinf(x) || __clc_isnan(x);
3030
*ep = __clc_select(e, (__CLC_INTN)0, is_inf_nan_or_zero);
3131
return __clc_select(__CLC_AS_GENTYPE(i), x, is_inf_nan_or_zero);
3232
}

0 commit comments

Comments
 (0)