8000 :bug: Emit only canonical NaNs · srcarroll/flexfloat@fc71910 · GitHub
[go: up one dir, main page]

Skip to content

Commit fc71910

Browse files
author
Stefan Mach
committed
🐛 Emit only canonical NaNs
1 parent 9e5ea9e commit fc71910

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/flexfloat.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ void flexfloat_sanitize(flexfloat_t *a)
286286
}
287287
else if(exp == INF_EXP && (CAST_TO_INT(a->value) & MASK_FRAC)) // NaN
288288
{
289-
exp = inf_exp;
289+
exp = inf_exp;
290+
// Sanitize to canonical NaN (positive sign, quiet bit set)
291+
sign = 0;
292+
frac = 0x1 << a->desc.frac_bits-1;
290293
}
291294
else if(exp == INF_EXP) // Inf
292295
{

0 commit comments

Comments
 (0)
0