Documentation ¶
Index ¶
- Constants
- func Mul32(x, y uint32) (hi, lo uint32)
- type ArbitraryType
- type IntegerType
- type Pointer
- type RMath
- func (math *RMath) Abs(input float64) float64
- func (math *RMath) Acosh(x float64) float64
- func (math *RMath) Add(x, y, carry uint) (sum, carryOut uint)
- func (math *RMath) Add32(x, y, carry uint32) (sum, carryOut uint32)
- func (math *RMath) Add64(x, y, carry uint64) (sum, carryOut uint64)
- func (math *RMath) Atan(x float64) float64
- func (math *RMath) Ceil(input float64) int
- func (math *RMath) Cos(input float64) float64
- func (math *RMath) Cot(input float64) float64
- func (math *RMath) Cqrt(input float64) float64
- func (math *RMath) Div(hi, lo, y uint) (quo, rem uint)
- func (math *RMath) Div32(hi, lo, y uint32) (quo, rem uint32)
- func (math *RMath) Div64(hi, lo, y uint64) (quo, rem uint64)
- func (math *RMath) FSBigNum(input []float64) float64
- func (math *RMath) FSLittleNum(input []float64) float64
- func (math *RMath) Fact(input int) int
- func (math *RMath) Fibo(input int)
- func (math *RMath) FindSlice(input interface{}, slice []interface{}) (bool, int, interface{})
- func (math *RMath) Float64bits(f float64) uint64
- func (math *RMath) Float64frombits(b uint64) float64
- func (math *RMath) Floor(input float64) int
- func (math *RMath) Fminus(input ...float64) float64
- func (math *RMath) Fmulti(input ...float64) float64
- func (math *RMath) Fsumer(input ...float64) float64
- func (math *RMath) ISBigNum(input []int) int
- func (math *RMath) ISLittleNum(input []int) int
- func (math *RMath) Iminus(input ...int) int
- func (math *RMath) Imod(num int, num2 int) int
- func (math *RMath) Imulti(input ...int) int
- func (math *RMath) Inf(sign int) float64
- func (math *RMath) IsEvenOdd(input int) bool
- func (math *RMath) IsInf(f float64, sign int) bool
- func (math *RMath) IsNaN(f float64) (is bool)
- func (math *RMath) IsPrime(input int) bool
- func (math *RMath) Isumer(input ...int) int
- func (math *RMath) LeadingZeros(x uint) int
- func (math *RMath) LeadingZeros16(x uint16) int
- func (math *RMath) LeadingZeros32(x uint32) int
- func (math *RMath) LeadingZeros64(x uint64) int
- func (math *RMath) LeadingZeros8(x uint8) int
- func (math *RMath) Len(x uint) int
- func (math *RMath) Len16(x uint16) (n int)
- func (math *RMath) Len32(x uint32) (n int)
- func (math *RMath) Len64(x uint64) (n int)
- func (math *RMath) Len8(x uint8) int
- func (math *RMath) Ln(input float64) float64
- func (math *RMath) Log10(input float64) float64
- func (math *RMath) Log1p(x float64) float64
- func (math *RMath) Log2(input float64) float64
- func (math *RMath) Mul(x, y uint) (hi, lo uint)
- func (math *RMath) Mul64(x, y uint64) (hi, lo uint64)
- func (math *RMath) NaN() float64
- func (math *RMath) OnesCount(x uint) int
- func (math *RMath) OnesCount16(x uint16) int
- func (math *RMath) OnesCount32(x uint32) int
- func (math *RMath) OnesCount64(x uint64) int
- func (math *RMath) OnesCount8(x uint8) int
- func (math *RMath) Pow(base float64, exponent int) float64
- func (math *RMath) Rem(hi, lo, y uint) uint
- func (math *RMath) Rem32(hi, lo, y uint32) uint32
- func (math *RMath) Rem64(hi, lo, y uint64) uint64
- func (math *RMath) Reverse(x uint) uint
- func (math *RMath) Reverse16(x uint16) uint16
- func (math *RMath) Reverse32(x uint32) uint32
- func (math *RMath) Reverse64(x uint64) uint64
- func (math *RMath) Reverse8(x uint8) uint8
- func (math *RMath) ReverseBytes(x uint) uint
- func (math *RMath) ReverseBytes16(x uint16) uint16
- func (math *RMath) ReverseBytes32(x uint32) uint32
- func (math *RMath) ReverseBytes64(x uint64) uint64
- func (math *RMath) Reverser(input int) (sum int, count int, ave float64)
- func (math *RMath) RotateLeft(x uint, k int) uint
- func (math *RMath) RotateLeft16(x uint16, k int) uint16
- func (math *RMath) RotateLeft32(x uint32, k int) uint32
- func (math *RMath) RotateLeft64(x uint64, k int) uint64
- func (math *RMath) RotateLeft8(x uint8, k int) uint8
- func (math *RMath) Round(input float64) int
- func (math *RMath) Sin(x float64) float64
- func (math *RMath) Sqrt(number float64) float64
- func (math *RMath) Sub(x, y, borrow uint) (diff, borrowOut uint)
- func (math *RMath) Sub32(x, y, borrow uint32) (diff, borrowOut uint32)
- func (math *RMath) Sub64(x, y, borrow uint64) (diff, borrowOut uint64)
- func (math *RMath) Tan(x float64) float64
- func (math *RMath) TrailingZeros(x uint) int
- func (math *RMath) TrailingZeros16(x uint16) int
- func (math *RMath) TrailingZeros32(x uint32) int
- func (math *RMath) TrailingZeros64(x uint64) int
- func (math *RMath) TrailingZeros8(x uint8) int
Constants ¶
const ( MaxFloat32 = 0x1p127 * (1 + (1 - 0x1p-23)) SmallestNonzeroFloat32 = 0x1p-126 * 0x1p-23 E = 2.71828182845904523536028747135266249775724709369995957496696763 Pi = 3.14159265358979323846264338327950288419716939937510582097494459 Phi = 1.61803398874989484820458683436563811772030917980576286213544862 Sqrt2 = 1.41421356237309504880168872420969807856967187537694807317667974 // https://oeis.org/A002193 SqrtE = 1.64872127070012814684865078781416357165377610071014801157507931 // https://oeis.org/A019774 SqrtPi = 1.77245385090551602729816748334114518279754945612238712821380779 // https://oeis.org/A002161 SqrtPhi = 1.27201964951406896425242246173749149171560804184009624861664038 // https://oeis.org/A139339 Ln2 = 0.693147180559945309417232121458176568075500134360255254120680009 // https://oeis.org/A002162 Log2E = 1 / Ln2 Ln10 = 2.30258509299404568401799145468436420760110148862877297603332790 // https://oeis.org/A002392 Log10E = 1 / Ln10 MaxFloat64 = 0x1p1023 * (1 + (1 - 0x1p-52)) // 1.79769313486231570814527423731704356798070e+308 SmallestNonzeroFloat64 = 0x1p-1022 * 0x1p-52 // 4.9406564584124654417656879286822137236505980e-324 Sqrt2M1 = 4.142135623730950488017e-01 // Sqrt(2)-1 = 0x3fda827999fcef34 Sqrt2HalfM1 = -2.928932188134524755992e-01 // Sqrt(2)/2-1 = 0xbfd2bec333018866 Small = 1.0 / (1 << 29) // 2**-29 = 0x3e20000000000000 Tiny = 1.0 / (1 << 54) // 2**-54 Two53 = 1 << 53 // 2**53 Ln2Hi = 6.93147180369123816490e-01 // 3fe62e42fee00000 Ln2Lo = 1.90821492927058770002e-10 // 3dea39ef35793c76 Lp1 = 6.666666666666735130e-01 // 3FE5555555555593 Lp2 = 3.999999999940941908e-01 // 3FD999999997FA04 Lp3 = 2.857142874366239149e-01 // 3FD2492494229359 Lp4 = 2.222219843214978396e-01 // 3FCC71C51D8E78AF Lp5 = 1.818357216161805012e-01 // 3FC7466496CB03DE Lp6 = 1.531383769920937332e-01 // 3FC39A09D078C69F Lp7 = 1.479819860511658591e-01 // 3FC2F112DF3E5244 )
const UintSize = uintSize
UintSize is the size of a uint in bits.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArbitraryType ¶
type ArbitraryType int
ArbitraryType is here for the purposes of documentation only and is not actually part of the unsafe package. It represents the type of an arbitrary Go expression.
type IntegerType ¶
type IntegerType int
IntegerType is here for the purposes of documentation only and is not actually part of the unsafe package. It represents any arbitrary integer type.
type Pointer ¶
type Pointer *ArbitraryType
Pointer represents a pointer to an arbitrary type. There are four special operations
type RMath ¶
type RMath struct { }
func (*RMath) Add ¶
Add returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
func (*RMath) Add32 ¶
Add32 returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1. This function's execution time does not depend on the inputs.
func (*RMath) Add64 ¶
Add64 returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1. This function's execution time does not depend on the inputs.
func (*RMath) Div32 ¶
Div32 returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. Div32 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
func (*RMath) Div64 ¶
Div64 returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. Div64 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
func (*RMath) FSLittleNum ¶
little number in slice for float Numbers float -slice-little-number
func (*RMath) Float64bits ¶
func (*RMath) Float64frombits ¶
func (*RMath) ISLittleNum ¶
little number in slice for int Numbers int -slice-little-number
func (*RMath) Inf ¶
//////////////////////////////////////////////////////////////////////////////////
func (*RMath) LeadingZeros ¶
LeadingZeros returns the number of leading zero bits in x; the result is UintSize for x == 0.
func (*RMath) LeadingZeros16 ¶
LeadingZeros16 returns the number of leading zero bits in x; the result is 16 for x == 0.
func (*RMath) LeadingZeros32 ¶
LeadingZeros32 returns the number of leading zero bits in x; the result is 32 for x == 0.
func (*RMath) LeadingZeros64 ¶
LeadingZeros64 returns the number of leading zero bits in x; the result is 64 for x == 0.
func (*RMath) LeadingZeros8 ¶
LeadingZeros8 returns the number of leading zero bits in x; the result is 8 for x == 0.
func (*RMath) Len ¶
Len returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func (*RMath) Len16 ¶
Len16 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func (*RMath) Len32 ¶
Len32 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func (*RMath) Len64 ¶
Len64 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func (*RMath) Len8 ¶
Len8 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func (*RMath) Mul ¶
Mul returns the full-width product of x and y: (hi, lo) = x * y with the product bits' upper half returned in hi and the lower half returned in lo. This function's execution time does not depend on the inputs.
func (*RMath) OnesCount16 ¶
OnesCount16 returns the number of one bits ("population count") in x.
func (*RMath) OnesCount32 ¶
OnesCount32 returns the number of one bits ("population count") in x.
func (*RMath) OnesCount64 ¶
OnesCount64 returns the number of one bits ("population count") in x.
func (*RMath) OnesCount8 ¶
OnesCount8 returns the number of one bits ("population count") in x.
func (*RMath) Rem ¶
Rem returns the remainder of (hi, lo) divided by y. Rem panics for y == 0 (division by zero) but, unlike Div, it doesn't panic on a quotient overflow.
func (*RMath) Rem32 ¶
Rem32 returns the remainder of (hi, lo) divided by y. Rem32 panics for y == 0 (division by zero) but, unlike Div32, it doesn't panic on a quotient overflow.
func (*RMath) Rem64 ¶
Rem64 returns the remainder of (hi, lo) divided by y. Rem64 panics for y == 0 (division by zero) but, unlike Div64, it doesn't panic on a quotient overflow.
func (*RMath) Reverse ¶
--- Reverse --- Reverse returns the value of x with its bits in reversed order.
func (*RMath) ReverseBytes ¶
ReverseBytes returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
func (*RMath) ReverseBytes16 ¶
ReverseBytes16 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
func (*RMath) ReverseBytes32 ¶
ReverseBytes32 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
func (*RMath) ReverseBytes64 ¶
ReverseBytes64 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
func (*RMath) RotateLeft ¶
RotateLeft returns the value of x rotated left by (k mod UintSize) bits. To rotate x right by k bits, call RotateLeft(x, -k). This function's execution time does not depend on the inputs.
func (*RMath) RotateLeft16 ¶
RotateLeft16 returns the value of x rotated left by (k mod 16) bits. To rotate x right by k bits, call RotateLeft16(x, -k). This function's execution time does not depend on the inputs.
func (*RMath) RotateLeft32 ¶
RotateLeft32 returns the value of x rotated left by (k mod 32) bits. To rotate x right by k bits, call RotateLeft32(x, -k). This function's execution time does not depend on the inputs.
func (*RMath) RotateLeft64 ¶
RotateLeft64 returns the value of x rotated left by (k mod 64) bits. To rotate x right by k bits, call RotateLeft64(x, -k). This function's execution time does not depend on the inputs.
func (*RMath) RotateLeft8 ¶
RotateLeft8 returns the value of x rotated left by (k mod 8) bits. To rotate x right by k bits, call RotateLeft8(x, -k). This function's execution time does not depend on the inputs.
func (*RMath) Sin ¶
Sin returns the sine of the radian argument x.
Special cases are:
Sin(±0) = ±0 Sin(±Inf) = NaN Sin(NaN) = NaN
func (*RMath) Sub ¶
Sub returns the difference of x, y and borrow: diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1. This function's execution time does not depend on the inputs.
func (*RMath) Sub32 ¶
Sub32 returns the difference of x, y and borrow, diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
func (*RMath) Sub64 ¶
Sub64 returns the difference of x, y and borrow: diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1. This function's execution time does not depend on the inputs.
func (*RMath) TrailingZeros ¶
TrailingZeros returns the number of trailing zero bits in x; the result is UintSize for x == 0.
func (*RMath) TrailingZeros16 ¶
TrailingZeros16 returns the number of trailing zero bits in x; the result is 16 for x == 0.
func (*RMath) TrailingZeros32 ¶
TrailingZeros32 returns the number of trailing zero bits in x; the result is 32 for x == 0.
func (*RMath) TrailingZeros64 ¶
TrailingZeros64 returns the number of trailing zero bits in x; the result is 64 for x == 0.
func (*RMath) TrailingZeros8 ¶
TrailingZeros8 returns the number of trailing zero bits in x; the result is 8 for x == 0.