(zb scode.Bytes)
| 83 | } |
| 84 | |
| 85 | func DecodeFloat(zb scode.Bytes) float64 { |
| 86 | switch len(zb) { |
| 87 | case 2: |
| 88 | bits := binary.LittleEndian.Uint16(zb) |
| 89 | return float64(float16.Frombits(bits).Float32()) |
| 90 | case 4: |
| 91 | bits := binary.LittleEndian.Uint32(zb) |
| 92 | return float64(math.Float32frombits(bits)) |
| 93 | case 8: |
| 94 | bits := binary.LittleEndian.Uint64(zb) |
| 95 | return math.Float64frombits(bits) |
| 96 | } |
| 97 | panic("float encoding is neither 4 nor 8 bytes") |
| 98 | } |
| 99 | |
| 100 | type TypeOfFloat16 struct{} |
| 101 |
no test coverage detected