OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / go-wire / float.go
1 package wire
2
3 import (
4         "io"
5         "math"
6 )
7
8 // Float32
9
10 func WriteFloat32(f float32, w io.Writer, n *int, err *error) {
11         WriteUint32(math.Float32bits(f), w, n, err)
12 }
13
14 func ReadFloat32(r io.Reader, n *int, err *error) float32 {
15         x := ReadUint32(r, n, err)
16         return math.Float32frombits(x)
17 }
18
19 // Float64
20
21 func WriteFloat64(f float64, w io.Writer, n *int, err *error) {
22         WriteUint64(math.Float64bits(f), w, n, err)
23 }
24
25 func ReadFloat64(r io.Reader, n *int, err *error) float64 {
26         x := ReadUint64(r, n, err)
27         return math.Float64frombits(x)
28 }