func (c *Composer) composeFloat32(f float32) error {
	if err := c.write1(absoluteFloat32); err != nil {
		return err
	}
	i := math.Float32bits(f)
	buf := []byte{byte(i >> 24), byte(i >> 16), byte(i >> 8), byte(i)}
	if _, err := c.write(buf); err != nil {
		return err
	}
	return nil
}
Write four bytes into the io.Writer
as an encoded CBOR float32
package cbor
import (
	"encoding/binary"
	"fmt"
	"io"
	"math"
	"math/big"
	"time"
	"unsafe"
)
type Composer struct {
	header     byte
	w          io.Writer
	indefinite bool
}
func NewComposer(w io.Writer) *Composer {
	return &Composer{w: w}
}
func (c *Composer) composeInformation(major Major, info byte) error {
	c.header = (byte(major) << 5) | info
	if _, err := c.w.Write([]byte{c.header}); err != nil {
		return fmt.Errorf("while composing inforamtion byte: %s", err)
	}
	return nil
}
func (c *Composer) write(buf []byte) (n int, err error) {
	if len(buf) == 0 || buf == nil {
		return 0, nil
	}
	n, err = c.w.Write(buf)
	if err != nil {
		return n, err
	}
	if n != len(buf) {
		err = fmt.Errorf("buf was %d bytes length but only %d bytes were written", len(buf), n)
	}
	return n, err
}
func (c *Composer) write1(b byte) error {
	if _, err := c.write([]byte{b}); err != nil {
		return err
	}
	return nil
}
func (c *Composer) composeNil() error {
	if err := c.write1(absoluteNil); err != nil {
		return fmt.Errorf("while writting nil value: %s", err.Error())
	}
	return nil
}
func (c *Composer) composeUint(i uint64, infoType ...Major) (n int, err error) {
	var t Major = cborUnsignedInt
	if len(infoType) > 0 {
		t = infoType[0]
	}
	if i < 24 {
		if err := c.composeInformation(t, byte(i)); err != nil {
			return 0, err
		}
		return 1, nil
	}
	if i <= math.MaxUint8 {
		if err := c.composeInformation(t, cborUint8); err != nil {
			return 0, err
		}
		return c.composeUint8(byte(i))
	}
	if i <= math.MaxUint16 {
		if err := c.composeInformation(t, cborUint16); err != nil {
			return 0, err
		}
		return c.composeUint16(uint16(i))
	}
	if i <= math.MaxUint32 {
		if err := c.composeInformation(t, cborUint32); err != nil {
			return 0, err
		}
		return c.composeUint32(uint32(i))
	}
	if i <= math.MaxUint64 {
		if err := c.composeInformation(t, cborUint64); err != nil {
			return 0, err
		}
		return c.composeUin64(i)
	}
	return 0, fmt.Errorf("totally unexpected error, Uint size is unknown %v!", i)
}
func (c *Composer) composeInt(i int64) (n int, err error) {
	if i < 0 {
		return c.composeUint(uint64(^i), cborNegativeInt)
	}
	return c.composeUint(uint64(i))
}
func (c *Composer) composeUint8(i uint8) (int, error) {
	if i < 24 {
		return 0, NewCanonicalModeError(fmt.Sprintf("%d must be send in a single byte 0x%x\n", i, i))
	}
	if err := binary.Write(c.w, binary.BigEndian, i); err != nil {
		return 0, err
	}
	return 1, nil
}
func (c *Composer) composeUint16(i uint16) (int, error) {
	buf := []byte{byte(i >> 8), byte(i)}
	if _, err := c.write(buf); err != nil {
		return 0, err
	}
	return 2, nil
}
func (c *Composer) composeUint32(i uint32) (int, error) {
	buf := []byte{byte(i >> 24), byte(i >> 16), byte(i >> 8), byte(i)}
	if _, err := c.write(buf); err != nil {
		return 0, err
	}
	return 4, nil
}
func (c *Composer) composeUin64(i uint64) (int, error) {
	buf := []byte{
		byte(i >> 56), byte(i >> 48), byte(i >> 40), byte(i >> 32),
		byte(i >> 24), byte(i >> 16), byte(i >> 8), byte(i),
	}
	if _, err := c.write(buf); err != nil {
		return 0, err
	}
	return 8, nil
}
func (c *Composer) composeBoolean(v bool) error {
	b := absoluteFalse
	if v {
		b = absoluteTrue
	}
	if err := c.write1(b); err != nil {
		return fmt.Errorf("while writting boolean %v value: %s", v, err.Error())
	}
	return nil
}
func (c *Composer) composeFloat16(f float16) error {
	if err := c.write1(absoluteFloat16); err != nil {
		return err
	}
	f16 := uint32toFloat16(*(*uint32)(unsafe.Pointer(&f)))
	buf := []byte{byte(f16 >> 8), byte(f16)}
	if _, err := c.write(buf); err != nil {
		return err
	}
	return nil
}