aboutsummaryrefslogtreecommitdiff
path: root/source/f32_to_f16.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/f32_to_f16.c')
-rw-r--r--source/f32_to_f16.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/f32_to_f16.c b/source/f32_to_f16.c
index a00b2e8..45005fe 100644
--- a/source/f32_to_f16.c
+++ b/source/f32_to_f16.c
@@ -72,6 +72,9 @@ float16_t f32_to_f16( float32_t a )
}
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
+ // frac is a 24-bit significand, the bottom 9 bits LSB are extracted and OR-red
+ // into a sticky flag, the top 15 MSBs are extracted, the LSB of this top slice
+ // is OR-red with the sticky
frac16 = frac>>9 | ((frac & 0x1FF) != 0);
if ( ! (exp | frac16) ) {
uiZ = packToF16UI( sign, 0, 0 );