Would binary16/bfloat16/other format serialization/deserialization be useful?
Peter McGoron 01 Nov 2026 22:24 UTC
Currently, this SRFI supports serializing numbers to binary32/binary64
(IEEE single/double precision), and deserializing binary32/binary64 to
numbers.
Would other formats, such as binary16, be useful? Binary16 numbers are
supported on modern x86_64 CPUs (AVX-512[1]). An implementation could
also use binary16 to read/write file formats that use binary16. There
are also bfloat16, and the numerous minifloat formats.
I think that given the ability to serialize/deserialize the native
floating point representation (with bytevector-flonum-native-ref and
bytevector-flonum-native-set! in SRFI 276[2]), one should be able to
write procedures for any floating point format desired without a major
speed penalty. Hence this is more a question of what formats are popular
enough that adding specific procedures for them would be worth it.
[1]: https://en.wikipedia.org/wiki/AVX-512#FP16
[2]: https://srfi.schemers.org/srfi-276/srfi-276.html#serialization
-- Peter McGoron