scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
401 stars 67 forks source link

Change names of fp8 types? #294

Closed scott-griffiths closed 8 months ago

scott-griffiths commented 10 months ago

Currently the fp8 formats are called float8_152 and float8_143. This is OK, except that ending with a number causes issues when parsing tokens and could cause confusion.

For example the token float8_153 is confusingly interpreted as an 8153 bit float (which then obviously fails).

Not having the name end with digits lets me simplify some code so that it doesn't need to know every possibly dtype name (the final digits can always be the length). It could also let other fp8 formats be represented, or this one could be changed if it gets standardised.

The best I can find online about the naming would suggest we use:

float8e5m2fnuz and float8e4m3fnuz, which don't exactly trip off the tongue, but do contain a lot of distinguishing information.

Perhaps we could provide more snappy aliases to these: e5m2float and e4m3float. You can append an 8 to any of these without a problem as it will just be interpreted as the bit length.

From the above link: "The suffix "FNUZ" is derived from these differences. F is for "finite" (no infinities), N for with special NaN encoding, UZ for unsigned zero."

The change could be made for 4.2 as they had the 'beta' tag in 4.1.

scott-griffiths commented 8 months ago

Done in 4.1.3.