From e520fa2e0fb3cfafe27a1f9e7e9b230dd58d7a33 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Wed, 25 Oct 2023 19:17:47 +0200 Subject: py/binary: Support half-float 'e' format in struct pack/unpack. This commit implements the 'e' half-float format: 10-bit mantissa, 5-bit exponent. It uses native _Float16 if supported by the compiler, otherwise uses custom bitshifting encoding/decoding routines. Signed-off-by: Matthias Urlichs Signed-off-by: Damien George --- docs/library/struct.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/library/struct.rst') diff --git a/docs/library/struct.rst b/docs/library/struct.rst index 026cb5e8ac..c235750596 100644 --- a/docs/library/struct.rst +++ b/docs/library/struct.rst @@ -45,6 +45,8 @@ The following data types are supported: +--------+--------------------+-------------------+---------------+ | Q | unsigned long long | integer (`1`) | 8 | +--------+--------------------+-------------------+---------------+ +| e | n/a (half-float) | float (`2`) | 2 | ++--------+--------------------+-------------------+---------------+ | f | float | float (`2`) | 4 | +--------+--------------------+-------------------+---------------+ | d | double | float (`2`) | 8 | -- cgit v1.2.3