half-rs
half-rs copied to clipboard
f16 serialization
Hi. I'm trying to serialize f16, but I'm stuck on it.
I'm using serde
feature, but when I use f16_var.serialize(serializer)
I'm getting unexpected results.
Example: Value: 1.0 Serialization result: "15360"`
If I convert the value to f32 and serialize it, everything is fine, I will get "1.0"` as expected.
Running on Ubuntu 20 under WSL
Currently f16 is being serialized as a u16, which works for binary formats, but not so much for string serialization. Will just need to do custom serialization implementation rather then using derive.