diff options
author | Matthias Urlichs <matthias@urlichs.de> | 2023-10-25 19:17:47 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-03-20 14:13:49 +1100 |
commit | e520fa2e0fb3cfafe27a1f9e7e9b230dd58d7a33 (patch) | |
tree | 0a1ddb9be05b6bea10af06c6d69620fc8c63acb9 /docs/library/struct.rst | |
parent | 77f08b72caeb26c7e3be5975d976e77d44099d43 (diff) | |
download | micropython-e520fa2e0fb3cfafe27a1f9e7e9b230dd58d7a33.tar.gz micropython-e520fa2e0fb3cfafe27a1f9e7e9b230dd58d7a33.zip |
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 <matthias@urlichs.de>
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/library/struct.rst')
-rw-r--r-- | docs/library/struct.rst | 2 |
1 files changed, 2 insertions, 0 deletions
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<fn>`) | 8 | +--------+--------------------+-------------------+---------------+ +| e | n/a (half-float) | float (`2<fn>`) | 2 | ++--------+--------------------+-------------------+---------------+ | f | float | float (`2<fn>`) | 4 | +--------+--------------------+-------------------+---------------+ | d | double | float (`2<fn>`) | 8 | |