Version: v0.0.2 Latest Latest

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 7 Imported by: 0




View Source
const (
	ToNearestEven big.RoundingMode = iota // == IEEE 754-2008 roundTiesToEven
	ToNearestAway                         // == IEEE 754-2008 roundTiesToAway
	ToZero                                // == IEEE 754-2008 roundTowardZero
	AwayFromZero                          // no IEEE 754-2008 equivalent
	ToNegativeInf                         // == IEEE 754-2008 roundTowardNegative
	ToPositiveInf                         // == IEEE 754-2008 roundTowardPositive

These constants define supported rounding modes.

View Source
const AutoPrec = 512 // 256 -> decimal 32   512 -> decimal 78


This section is empty.


This section is empty.


type BigFloat

type BigFloat struct {
	// contains filtered or unexported fields

func Zero

func Zero() *BigFloat

func (*BigFloat) Abs

func (bf *BigFloat) Abs(a BigFloat)

func (*BigFloat) Add

func (bf *BigFloat) Add(a BigFloat, b BigFloat)

@todo calc pointer param

func (*BigFloat) BF

func (bf *BigFloat) BF() big.Float

func (*BigFloat) Ceil

func (bf *BigFloat) Ceil() (*BigFloat, error)

func (*BigFloat) Cmp

func (bf *BigFloat) Cmp(a BigFloat) int

func (*BigFloat) Convert

func (bf *BigFloat) Convert(f *big.Float) error

func (*BigFloat) Copy

func (bf *BigFloat) Copy(newBf *BigFloat) error

func (*BigFloat) CreateFromString

func (bf *BigFloat) CreateFromString(s string, mode big.RoundingMode) error

func (*BigFloat) Div

func (bf *BigFloat) Div(a BigFloat, b BigFloat, isInf ...bool)

func (*BigFloat) Float

func (bf *BigFloat) Float() *big.Float

func (*BigFloat) Floor

func (bf *BigFloat) Floor() (*BigFloat, error)

func (BigFloat) MarshalBinary

func (bf BigFloat) MarshalBinary() (data []byte, err error)

func (BigFloat) MarshalJSON

func (bf BigFloat) MarshalJSON() ([]byte, error)

@todo xml protobuf ...

func (*BigFloat) Mul

func (bf *BigFloat) Mul(a BigFloat, b BigFloat)

func (*BigFloat) Round

func (bf *BigFloat) Round(decimal uint, roundType RoundType) (*BigFloat, error)

func (*BigFloat) Scan

func (bf *BigFloat) Scan(src interface{}) error

func (*BigFloat) SetInt

func (bf *BigFloat) SetInt(i *bigint.BigInt, mode big.RoundingMode) error

func (*BigFloat) String

func (bf *BigFloat) String() string

func (*BigFloat) Sub

func (bf *BigFloat) Sub(a BigFloat, b BigFloat)

func (*BigFloat) UnmarshalBinary

func (bf *BigFloat) UnmarshalBinary(data []byte) error

func (*BigFloat) UnmarshalJSON

func (bf *BigFloat) UnmarshalJSON(src []byte) error

func (BigFloat) Value

func (bf BigFloat) Value() (driver.Value, error)

type RoundType

type RoundType byte
const (
	RoundUpAlways RoundType = iota

type Slice

type Slice []*BigFloat

func (Slice) Len

func (s Slice) Len() int

func (Slice) Less

func (s Slice) Less(i, j int) bool

func (Slice) Swap

func (s Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL