decimal256

package
v10.0.0-...-859720e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPrecision = 76
	MaxScale     = 76
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Num

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

func FromBigInt

func FromBigInt(v *big.Int) (n Num)

func FromDecimal128

func FromDecimal128(n decimal128.Num) Num

func FromFloat32

func FromFloat32(v float32, prec, scale int32) (Num, error)

func FromFloat64

func FromFloat64(v float64, prec, scale int32) (Num, error)

func FromI64

func FromI64(v int64) Num

func FromU64

func FromU64(v uint64) Num

func New

func New(x1, x2, x3, x4 uint64) Num

New returns a new signed 256-bit integer value where x1 contains the highest bits with the rest of the values in order down to the lowest bits

ie: New(1, 2, 3, 4) returns with the elements in little-endian order
    {4, 3, 2, 1} but each value is still represented as the native endianness

func (Num) Abs

func (n Num) Abs() Num

func (Num) Array

func (n Num) Array() [4]uint64

func (Num) BigInt

func (n Num) BigInt() *big.Int

func (Num) FitsInPrecision

func (n Num) FitsInPrecision(prec int32) bool

func (Num) IncreaseScaleBy

func (n Num) IncreaseScaleBy(increase int32) Num

func (Num) Less

func (n Num) Less(other Num) bool

func (Num) LowBits

func (n Num) LowBits() uint64

func (Num) Negate

func (n Num) Negate() Num

func (Num) ReduceScaleBy

func (n Num) ReduceScaleBy(reduce int32, round bool) Num

func (Num) Rescale

func (n Num) Rescale(original, newscale int32) (out Num, err error)

func (Num) Sign

func (n Num) Sign() int

func (Num) ToFloat32

func (n Num) ToFloat32(scale int32) float32

func (Num) ToFloat64

func (n Num) ToFloat64(scale int32) float64

Jump to

Keyboard shortcuts

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