Add Float40 methods

This commit adds Float40 related methods, and keeps the Float16 version
which will be deleted in a near future once the Float40 migration is
ready.
This commit is contained in:
arnaucube
2021-02-08 16:08:13 +01:00
parent ea63cba62a
commit 52d4197330
4 changed files with 203 additions and 5 deletions

View File

@@ -30,6 +30,7 @@ func (f16 Float16) Bytes() []byte {
// Float16FromBytes returns a Float16 from a byte array of 2 bytes.
func Float16FromBytes(b []byte) *Float16 {
// WARNING b[:2] for a b where len(b)<2 can break
f16 := Float16(binary.BigEndian.Uint16(b[:2]))
return &f16
}