fix edge case in F8->u8

This commit is contained in:
numzero 2025-11-02 01:58:07 +03:00
parent 7ea2d49d3d
commit 86d1156968

View File

@ -61,7 +61,11 @@ impl From<F8> for u8 {
return 0;
}
let (m, e) = value.split_unbias();
if e >= 0 { m << e } else { m >> -e }
match e {
0.. => m << e,
-7..0 => m >> -e,
..-7 => 0,
}
}
}