irfpy.util.minifloat
¶
This module provides a routines to convert minifloats.
Code author: Martin Wieser
You may also find document: https://mrob.com/pub/math/floatformats.html#microfloat
Functions to convert between f8 minifloats and integers. minifloats are 8 bit in size and have the following structure: The names used are of historical origin
Name |
s.e.m |
Excess |
Integer range covered |
Used |
f8 |
0.4.4 |
-4 |
0 to 507903 |
ICA, IMA, JDC |
n8 |
1.4.3 |
-4 |
-2xxxxx to +2xxxxx |
JDC |
s: sign bits
e: exponent bits
m: mantissa bits
Special case:
Name |
s.e.m |
Excess |
Integer range covered |
Used |
s8 |
0.2.6 |
-3 |
0 to 951 |
JDC, no denormals, +64 offset |
-
irfpy.util.minifloat.
u24_f8
(u24)[source]¶ Convert an 24 bit integer to a f8 minifloat. In case of overflow 0xFF is returned
-
irfpy.util.minifloat.
f8_u16
(f8)[source]¶ Convert a f8 minifloat to 16-bit integer. In case of overflow 0xFFFF is returned
-
irfpy.util.minifloat.
f8_u24
(f8)[source]¶ Convert a f8 minifloat to 24-bit integer. no overflow possible
-
irfpy.util.minifloat.
i24_n8
(i24)[source]¶ Convert an 24 bit signed integer to a n8 minifloat. In case of overflow 0xFF is returned