eos_math

package
v0.0.0-...-e0ee87b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const (
	MaxInt8   = 1<<7 - 1
	MinInt8   = -1 << 7
	MaxInt16  = 1<<15 - 1
	MinInt16  = -1 << 15
	MaxInt32  = 1<<31 - 1
	MinInt32  = -1 << 31
	MaxInt64  = 1<<63 - 1
	MinInt64  = -1 << 63
	MaxUint8  = 1<<8 - 1
	MaxUint16 = 1<<16 - 1
	MaxUint32 = 1<<32 - 1
	MaxUint64 = 1<<64 - 1
)

Integer limit values.

View Source
const DBL_MANT_DIG = 53

seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm

Variables

This section is empty.

Functions

func F128ToI32

func F128ToI32(a Float128, roundingMode uint8, exact bool) int32

func F128ToI64

func F128ToI64(a Float128, roundingMode uint8, exact bool) int64

func F128ToUi32

func F128ToUi32(a Float128, roundingMode uint8, exact bool) uint32

func F128ToUi64

func F128ToUi64(a Float128, roundingMode uint8, exact bool) uint64

func Floattidf

func Floattidf(a Int128) float64

func Floatuntidf

func Floatuntidf(a Uint128) float64

seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm

func MustParseUint64

func MustParseUint64(s string) uint64

MustParseUint64 parses s as an integer and panics if the string is invalid.

func ParseUint64

func ParseUint64(s string) (uint64, bool)

ParseUint64 parses s as an integer in decimal or hexadecimal syntax. Leading zeros are accepted. The empty string parses as zero.

func SafeAdd

func SafeAdd(x, y uint64) (uint64, bool)

SafeAdd returns the result and whether overflow occurred.

func SafeMul

func SafeMul(x, y uint64) (uint64, bool)

SafeMul returns multiplication result and whether overflow occurred.

func SafeSub

func SafeSub(x, y uint64) (uint64, bool)

SafeSub returns subtraction result and whether overflow occurred.

Types

type ExtFloat80M

type ExtFloat80M struct {
	// contains filtered or unexported fields
}

type ExtFloat80_t

type ExtFloat80_t ExtFloat80M

type Float128

type Float128 struct {
	Low  uint64
	High uint64
}

func F32ToF128

func F32ToF128(a Float32) Float128

func F64ToF128

func F64ToF128(a Float64) Float128

func I32ToF128

func I32ToF128(a int32) Float128

func I64ToF128

func I64ToF128(a int64) Float128

func Ui32ToF128

func Ui32ToF128(a uint32) Float128

func Ui64ToF128

func Ui64ToF128(a uint64) Float128

func (Float128) Add

func (a Float128) Add(b Float128) Float128

func (Float128) Bytes

func (f Float128) Bytes() []byte

func (Float128) Div

func (a Float128) Div(b Float128) Float128

func (Float128) F128EQ

func (f Float128) F128EQ(b Float128) bool

func (Float128) F128Lt

func (f Float128) F128Lt(b Float128) bool

func (*Float128) IsNan

func (f *Float128) IsNan() bool

func (Float128) Mul

func (a Float128) Mul(b Float128) Float128

func (Float128) String

func (f Float128) String() string

func (Float128) Sub

func (a Float128) Sub(b Float128) Float128

type Float16

type Float16 uint16

type Float32

type Float32 uint32

func F128ToF32

func F128ToF32(a Float128) Float32

func (Float32) String

func (f Float32) String() string

type Float64

type Float64 uint64

func F128ToF64

func F128ToF64(a Float128) Float64

func I32ToF64

func I32ToF64(a int32) Float64

func (Float64) String

func (f Float64) String() string

type HexOrDecimal64

type HexOrDecimal64 uint64

HexOrDecimal64 marshals uint64 as hex or decimal.

func (HexOrDecimal64) MarshalText

func (i HexOrDecimal64) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*HexOrDecimal64) UnmarshalText

func (i *HexOrDecimal64) UnmarshalText(input []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Int128

type Int128 struct {
	Low  uint64
	High uint64
}

func CreateInt128

func CreateInt128(i int) Int128

func Fixdfti

func Fixdfti(a uint64) Int128

func Fixsfti

func Fixsfti(a uint32) Int128

func Fixtfti

func Fixtfti(a Float128) Int128

func MaxInt128

func MaxInt128() Int128

func MinInt128

func MinInt128() Int128

func (Int128) Add

func (u Int128) Add(v Int128) Int128

func (Int128) Div

func (u Int128) Div(v Int128) (Int128, Int128)

func (Int128) GetAt

func (u Int128) GetAt(i uint) bool

func (Int128) IsZero

func (u Int128) IsZero() bool

func (*Int128) LeftShift

func (u *Int128) LeftShift()

func (*Int128) LeftShifts

func (u *Int128) LeftShifts(shift int)

func (Int128) Mul

func (u Int128) Mul(v Int128) Int128

func (*Int128) RightShift

func (u *Int128) RightShift()

func (*Int128) RightShifts

func (u *Int128) RightShifts(shift int)

func (*Int128) Set

func (u *Int128) Set(i uint, b uint)

func (Int128) String

func (u Int128) String() string

func (Int128) Sub

func (u Int128) Sub(v Int128) Int128

func (Int128) ToTrueForm

func (u Int128) ToTrueForm() Uint128

type Mant

type Mant struct {
	High uint64
	Low  uint64
}

type Uint128

type Uint128 struct {
	Low  uint64
	High uint64
}

func CreateUint128

func CreateUint128(i int) Uint128

func Fixunsdfti

func Fixunsdfti(a uint64) Uint128

func Fixunssfti

func Fixunssfti(a uint32) Uint128

func Fixunstfti

func Fixunstfti(a Float128) Uint128

func MaxUint128

func MaxUint128() Uint128

func MinUint128

func MinUint128() Uint128

func MulUint64

func MulUint64(u, v uint64) Uint128

func (Uint128) Add

func (u Uint128) Add(v Uint128) Uint128

func (Uint128) And

func (u Uint128) And(v Uint128) Uint128

func (Uint128) Compare

func (u Uint128) Compare(v Uint128) int

if u > v , return 1; u < v , return -1; u = v , return 0 .

func (Uint128) Div

func (u Uint128) Div(divisor Uint128) (Uint128, Uint128)

func (Uint128) GetAt

func (u Uint128) GetAt(i uint) bool

func (Uint128) IsZero

func (u Uint128) IsZero() bool

func (*Uint128) LeftShift

func (u *Uint128) LeftShift()

func (*Uint128) LeftShifts

func (u *Uint128) LeftShifts(shift int)

func (Uint128) Mul

func (u Uint128) Mul(v Uint128) Uint128

func (Uint128) Or

func (u Uint128) Or(v Uint128) Uint128

func (*Uint128) RightShift

func (u *Uint128) RightShift()

func (*Uint128) RightShifts

func (u *Uint128) RightShifts(shift int)

func (*Uint128) RightShifts2

func (u *Uint128) RightShifts2(shift int) Uint128

func (*Uint128) Set

func (u *Uint128) Set(i uint, b uint)

func (Uint128) Sqrt

func (u Uint128) Sqrt() uint64

func (Uint128) String

func (u Uint128) String() string

func (Uint128) Sub

func (u Uint128) Sub(v Uint128) Uint128

func (Uint128) ToComplement

func (u Uint128) ToComplement() Int128

func (Uint128) ToUint128Bytes

func (u Uint128) ToUint128Bytes() Uint128Bytes

type Uint128Bytes

type Uint128Bytes struct {
	LowBytes  []byte
	HighBytes []byte
}

type Uint256

type Uint256 struct {
	Low  Uint128
	High Uint128
}

func (Uint256) Add

func (u Uint256) Add(v Uint256) Uint256

func (Uint256) Compare

func (u Uint256) Compare(v Uint256) int

func (Uint256) Div

func (u Uint256) Div(divisor Uint256) (Uint256, Uint256)

func (Uint256) GetAt

func (u Uint256) GetAt(i uint) bool

func (Uint256) IsZero

func (u Uint256) IsZero() bool

func (*Uint256) LeftShift

func (u *Uint256) LeftShift()

func (*Uint256) LeftShifts

func (u *Uint256) LeftShifts(shift int)

func (Uint256) Mul

func (u Uint256) Mul(v Uint256) Uint256

func (*Uint256) RightShift

func (u *Uint256) RightShift()

func (*Uint256) RightShifts

func (u *Uint256) RightShifts(shift int)

func (*Uint256) Set

func (u *Uint256) Set(i uint, b uint)

func (Uint256) String

func (u Uint256) String() string

func (Uint256) Sub

func (u Uint256) Sub(v Uint256) Uint256

Jump to

Keyboard shortcuts

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