half-rs icon indicating copy to clipboard operation
half-rs copied to clipboard

f16 serialization

Open NazarKostetskiy opened this issue 1 year ago • 1 comments

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

NazarKostetskiy avatar Aug 28 '22 14:08 NazarKostetskiy

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.

starkat99 avatar Aug 29 '22 21:08 starkat99