func (d *Decoder) DecodeDouble() (float64, int, error) {
	var buf [8]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 8)
		err := unmarshalError("DecodeDouble", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	val := uint64(buf[7]) | uint64(buf[6])<<8 |
		uint64(buf[5])<<16 | uint64(buf[4])<<24 |
		uint64(buf[3])<<32 | uint64(buf[2])<<40 |
		uint64(buf[1])<<48 | uint64(buf[0])<<56
	return math.Float64frombits(val), n, nil
}
DecodeDouble treats the next 8 bytes as an XDR encoded double-precision
floating point and returns the result as a float64 along with the number of
bytes actually read.

An UnmarshalError is returned if there are insufficient bytes remaining.

Reference:
RFC Section 4.7 -  Double-Precision Floating Point
64-bit double-precision IEEE 754 floating point
package xdr
import (
	"fmt"
	"io"
	"math"
	"reflect"
	"strconv"
	"time"
)
const maxInt32 = int(^uint32(0) >> 1)
var errMaxSlice = "data exceeds max slice limit"
var errIODecode = "%s while decoding %d bytes"
func Unmarshal(r io.Reader, v interface{}) (int, error) {
	d := Decoder{r: r}
	return d.Decode(v)
}
type Decoder struct {
	r io.Reader
}
func (d *Decoder) DecodeInt() (int32, int, error) {
	var buf [4]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 4)
		err := unmarshalError("DecodeInt", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	rv := int32(buf[3]) | int32(buf[2])<<8 |
		int32(buf[1])<<16 | int32(buf[0])<<24
	return rv, n, nil
}
func (d *Decoder) DecodeUint() (uint32, int, error) {
	var buf [4]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 4)
		err := unmarshalError("DecodeUint", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	rv := uint32(buf[3]) | uint32(buf[2])<<8 |
		uint32(buf[1])<<16 | uint32(buf[0])<<24
	return rv, n, nil
}
func (d *Decoder) DecodeEnum(validEnums map[int32]bool) (int32, int, error) {
	val, n, err := d.DecodeInt()
	if err != nil {
		return 0, n, err
	}
	if !validEnums[val] {
		err := unmarshalError("DecodeEnum", ErrBadEnumValue,
			"invalid enum", val, nil)
		return 0, n, err
	}
	return val, n, nil
}
func (d *Decoder) DecodeBool() (bool, int, error) {
	val, n, err := d.DecodeInt()
	if err != nil {
		return false, n, err
	}
	switch val {
	case 0:
		return false, n, nil
	case 1:
		return true, n, nil
	}
	err = unmarshalError("DecodeBool", ErrBadEnumValue, "bool not 0 or 1",
		val, nil)
	return false, n, err
}
func (d *Decoder) DecodeHyper() (int64, int, error) {
	var buf [8]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 8)
		err := unmarshalError("DecodeHyper", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	rv := int64(buf[7]) | int64(buf[6])<<8 |
		int64(buf[5])<<16 | int64(buf[4])<<24 |
		int64(buf[3])<<32 | int64(buf[2])<<40 |
		int64(buf[1])<<48 | int64(buf[0])<<56
	return rv, n, err
}
func (d *Decoder) DecodeUhyper() (uint64, int, error) {
	var buf [8]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 8)
		err := unmarshalError("DecodeUhyper", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	rv := uint64(buf[7]) | uint64(buf[6])<<8 |
		uint64(buf[5])<<16 | uint64(buf[4])<<24 |
		uint64(buf[3])<<32 | uint64(buf[2])<<40 |
		uint64(buf[1])<<48 | uint64(buf[0])<<56
	return rv, n, nil
}
func (d *Decoder) DecodeFloat() (float32, int, error) {
	var buf [4]byte
	n, err := io.ReadFull(d.r, buf[:])
	if err != nil {
		msg := fmt.Sprintf(errIODecode, err.Error(), 4)
		err := unmarshalError("DecodeFloat", ErrIO, msg, buf[:n], err)
		return 0, n, err
	}
	val := uint32(buf[3]) | uint32(buf[2])<<8 |
		uint32(buf[1])<<16 | uint32(buf[0])<<24
	return math.Float32frombits(val), n, nil
}