decimal: github.com/anz-bank/decimal Index | Files

package decimal

import "github.com/anz-bank/decimal"

Index

Package Files

decimal64.go decimal64const.go decimal64decParts.go decimal64fmt.go decimal64gob.go decimal64json.go decimal64marshal.go decimal64math.go decimal64scan.go logic.go stringScanner.go uint128.go

Variables

var DefaultContext = Context64{roundHalfUp}

DefaultContext is the context that Arithmetic functions will use in order to do calculations

var E64 = newFromParts(0, -15, 2718281828459045)

E64 represents e (lim[n→∞](1+1/n)ⁿ).

var Infinity64 = Decimal64{inf64}

Infinity64 represents ∞ as a Decimal64.

var Max64 = newFromParts(0, expMax, maxSig)

Max64 is the maximum number representable with a Decimal64.

var Min64 = newFromParts(0, -398, 1)

Min64 is the smallest number that is subnormal possible with Decimal64.

var NegInfinity64 = Decimal64{neg64 | inf64}

NegInfinity64 represents -∞ as a Decimal64.

var NegMax64 = newFromParts(1, expMax, maxSig)

NegMax64 is the minimum finite number (most negative) possible with Decimal64 (negative).

var NegOne64 = newFromParts(1, -15, decimal64Base)

NegOne64 represents -1 as a Decimal64.

var NegZero64 = newFromParts(1, 0, 0)

NegZero64 represents -0 as a Decimal64.

var One64 = newFromParts(0, -15, decimal64Base)

One64 represents 1 as a Decimal64.

var Pi64 = newFromParts(0, -15, 3141592653589793)

Pi64 represents π.

var QNaN64 = Decimal64{0x7c << 56}

QNaN64 represents a quiet NaN as a Decimal64.

var SNaN64 = Decimal64{0x7e << 56}

SNaN64 represents a signalling NaN as a Decimal64.

var Zero64 = newFromParts(0, 0, 0)

Zero64 represents 0 as a Decimal64.

type Context64 Uses

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

Context64 stores the rounding type for arithmetic operations.

func (Context64) Add Uses

func (ctx Context64) Add(d, e Decimal64) Decimal64

Add computes d + e

func (Context64) FMA Uses

func (ctx Context64) FMA(d, e, f Decimal64) Decimal64

FMA computes d*e + f

func (Context64) Mul Uses

func (ctx Context64) Mul(d, e Decimal64) Decimal64

Mul computes d * e

func (Context64) Quo Uses

func (ctx Context64) Quo(d, e Decimal64) Decimal64

Quo computes d / e.

type Decimal64 Uses

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

Decimal64 represents an IEEE 754 64-bit floating point decimal number. It uses the binary representation method. Decimal64 is intentionally a struct to ensure users don't accidentally cast it to uint64

func MustParse64 Uses

func MustParse64(s string) Decimal64

MustParse64 parses a string as a Decimal64 and returns the value or panics if the string doesn't represent a valid Decimal64.

func New64FromInt64 Uses

func New64FromInt64(value int64) Decimal64

New64FromInt64 returns a new Decimal64 with the given value.

func Parse64 Uses

func Parse64(s string) (Decimal64, error)

Parse64 parses a string representation of a number as a Decimal64.

func (Decimal64) Abs Uses

func (d Decimal64) Abs() Decimal64

Abs computes ||d||.

func (Decimal64) Add Uses

func (d Decimal64) Add(e Decimal64) Decimal64

Add computes d + e with default rounding

func (Decimal64) Append Uses

func (d Decimal64) Append(buf []byte, format byte, prec int) []byte

Append appends the text representation of d to buf.

func (Decimal64) Class Uses

func (d Decimal64) Class() string

Class returns a string of the 'type' that the decimal is.

func (Decimal64) Cmp Uses

func (d Decimal64) Cmp(e Decimal64) int

Cmp returns:

-2 if d or e is NaN
-1 if d <  e
 0 if d == e (incl. -0 == 0, -Inf == -Inf, and +Inf == +Inf)
+1 if d >  e

func (Decimal64) FMA Uses

func (d Decimal64) FMA(e, f Decimal64) Decimal64

FMA computes d*e + f with default rounding.

func (Decimal64) Float64 Uses

func (d Decimal64) Float64() float64

Float64 returns a float64 representation of d.

func (Decimal64) Format Uses

func (d Decimal64) Format(s fmt.State, format rune)

Format implements fmt.Formatter.

func (*Decimal64) GobDecode Uses

func (d *Decimal64) GobDecode(buf []byte) error

GobDecode implements encoding.GobDecoder.

func (Decimal64) GobEncode Uses

func (d Decimal64) GobEncode() ([]byte, error)

GobEncode implements encoding.GobEncoder.

func (Decimal64) Int64 Uses

func (d Decimal64) Int64() int64

Int64 converts d to an int64.

func (Decimal64) IsInf Uses

func (d Decimal64) IsInf() bool

IsInf returns true iff d = ±∞.

func (Decimal64) IsInt Uses

func (d Decimal64) IsInt() bool

IsInt returns true iff d is an integer.

func (Decimal64) IsNaN Uses

func (d Decimal64) IsNaN() bool

IsNaN returns true iff d is not a number.

func (Decimal64) IsQNaN Uses

func (d Decimal64) IsQNaN() bool

IsQNaN returns true iff d is a quiet NaN.

func (Decimal64) IsSNaN Uses

func (d Decimal64) IsSNaN() bool

IsSNaN returns true iff d is a signalling NaN.

func (Decimal64) IsSubnormal Uses

func (d Decimal64) IsSubnormal() bool

IsSubnormal returns true iff d is a subnormal.

func (Decimal64) IsZero Uses

func (d Decimal64) IsZero() bool

IsZero returns true if the Decimal encodes a zero value.

func (Decimal64) MarshalJSON Uses

func (d Decimal64) MarshalJSON() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Decimal64) MarshalText Uses

func (d Decimal64) MarshalText() []byte

MarshalText implements the encoding.TextMarshaler interface.

func (Decimal64) Mul Uses

func (d Decimal64) Mul(e Decimal64) Decimal64

Mul computes d * e with default rounding.

func (Decimal64) Neg Uses

func (d Decimal64) Neg() Decimal64

Neg computes -d.

func (Decimal64) Quo Uses

func (d Decimal64) Quo(e Decimal64) Decimal64

Quo computes d / e with default rounding.

func (*Decimal64) Scan Uses

func (d *Decimal64) Scan(state fmt.ScanState, verb rune) error

Scan implements fmt.Scanner.

func (Decimal64) Sign Uses

func (d Decimal64) Sign() int

Sign returns -1/0/1 depending on whether d is </=/> 0.

func (Decimal64) Signbit Uses

func (d Decimal64) Signbit() bool

Signbit returns true iff d is negative or -0.

func (Decimal64) Sqrt Uses

func (d Decimal64) Sqrt() Decimal64

Sqrt computes √d.

func (Decimal64) String Uses

func (d Decimal64) String() string

String returns a string representation of d.

func (Decimal64) Sub Uses

func (d Decimal64) Sub(e Decimal64) Decimal64

Sub returns d - e.

func (Decimal64) Text Uses

func (d Decimal64) Text(format byte, prec int) string

Text converts the floating-point number x to a string according to the given format and precision prec.

func (*Decimal64) UnmarshalJSON Uses

func (d *Decimal64) UnmarshalJSON(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*Decimal64) UnmarshalText Uses

func (d *Decimal64) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Package decimal imports 8 packages (graph). Updated 2019-11-15. Refresh now. Tools for package owners.