Closed lain-dono closed 5 years ago
Should be a custom type like Int3 from here: https://github.com/lunixbochs/struc/issues/35
I'm almost done implementing it.
You should be able to use the struc.Float16
type for field values now. I'll need to do some plumbing before it's usable via struc:"float16"
because that can't be used to specify completely custom types yet.
There's a pile of tests listed here that should handle most cases: https://github.com/lunixbochs/struc/blob/master/custom_float16_test.go#L19
It has some mild precision issues vs float64 at the extreme ends and doesn't pack/unpack -0
properly, so those tests are disabled, but that's to be expected.
FWIW I consider this issue closeable.
wiki: Half-precision floating-point format