numeric

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64ToSortableLong added in v0.0.2

func Float64ToSortableLong(value float64) uint64

Float64ToSortableLong Converts a double value to a sortable signed long. The value is converted by getting their IEEE 754 floating-point "double format" bit layout and then some bits are swapped, to be able to compare the result as long. By this the precision is not reduced, but the value can easily used as a long. The sort order (including Double.NaN) is defined by Double.compareTo; NaN is greater than positive infinity. SortableLongToDouble

func IntToSortableBytes

func IntToSortableBytes(value int32, result []byte)

IntToSortableBytes Encodes an int32 value such that unsigned byte order comparison is consistent with Integer.compare(int, int) 请参阅: SortableBytesToInt(byte[], int)

func SortableBytesToInt

func SortableBytesToInt(encoded []byte) int32

SortableBytesToInt Decodes an integer value previously written with intToSortableBytes 请参阅: IntToSortableBytes(int, byte[])

func SortableBytesToLong

func SortableBytesToLong(encoded []byte) int64

SortableBytesToLong Decodes a long value previously written with Uint64ToSortableBytes

func SortableBytesToUint64

func SortableBytesToUint64(encoded []byte) uint64

SortableBytesToUint64 Decodes a long value previously written with Uint64ToSortableBytes

func SortableFloat64Bits added in v0.0.2

func SortableFloat64Bits(bits uint64) uint64

SortableFloat64Bits Converts IEEE 754 representation of a double to sortable order (or back to the original)

func SortableUint64ToFloat64 added in v0.0.2

func SortableUint64ToFloat64(encoded uint64) float64

SortableUint64ToFloat64 Converts a sortable long back to a double. 请参阅: Float64ToSortableLong

func Subtract

func Subtract(bytesPerDim, dim int, a, b, result []byte) error

Subtract Result = a - b, where a >= b, else IllegalArgumentException is thrown.

func Uint64ToSortableBytes added in v0.0.2

func Uint64ToSortableBytes(num uint64, result []byte)

Uint64ToSortableBytes Encodes an long value such that unsigned byte order comparison is consistent with Long.compare(long, long) See Also: sortableBytesToLong(byte[], int)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL