Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MaxDecimal128 = New(542101086242752217, 687399551400673280-1)
)
Functions ¶
This section is empty.
Types ¶
type Num ¶
type Num struct {
// contains filtered or unexported fields
}
Num represents a signed 128-bit integer in two's complement. Calculations wrap around and overflow is ignored.
For a discussion of the algorithms, look at Knuth's volume 2, Semi-numerical Algorithms section 4.3.1.
Adapted from the Apache ORC C++ implementation
func FromBigInt ¶
FromBigInt will convert a big.Int to a Num, if the value in v has a BitLen > 128, this will panic.
func (Num) BigInt ¶
while the code would be simpler to just do lsh/rsh and add it turns out from benchmarking that calling SetBits passing in the words and negating ends up being >2x faster
func (Num) HighBits ¶
HighBits returns the high bits of the two's complement representation of the number.
Click to show internal directories.
Click to hide internal directories.