MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Float64

Method Float64

utils/writer.go:120–129  ·  view source on GitHub ↗

Float64 writes a float64.

(val float64)

Source from the content-addressed store, hash-verified

118
119// Float64 writes a float64.
120func (writer *Writer) Float64(val float64) {
121 // Float encoding produces byte-comparable serialized values when looking at the exponent and mantissa. This means
122 // that we just have to flip to exponent and mantissa for negative values, and flip the sign bit so that negatives
123 // sort before positives. To do this, we take advantage of arithmetic shifting by casting to a signed integer to
124 // create a mask that only exists for negative values.
125 uval := math.Float64bits(val)
126 uval ^= uint64(int64(uval)>>63) & 0x7FFFFFFFFFFFFFFF
127 uval ^= 0x8000000000000000
128 writer.Uint64(uval)
129}
130
131// VariableInt writes an int64 using variable-length encoding. Smaller values use less space at the cost of larger
132// values using more bytes, but this is generally more space-efficient. This does carry a small computational hit when

Callers 3

TestWriterReaderFunction · 0.95
TestWriterOrderFunction · 0.95
Float64SliceMethod · 0.95

Calls 1

Uint64Method · 0.95

Tested by 2

TestWriterReaderFunction · 0.76
TestWriterOrderFunction · 0.76