MCPcopy Create free account
hub / github.com/brimdata/super / DecodeFloat

Function DecodeFloat

primitive.go:85–98  ·  view source on GitHub ↗
(zb scode.Bytes)

Source from the content-addressed store, hash-verified

83}
84
85func 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
100type TypeOfFloat16 struct{}
101

Callers 3

WriteMethod · 0.92
loadAnyWithLockMethod · 0.92
FloatMethod · 0.85

Calls 1

Float32Method · 0.80

Tested by

no test coverage detected