number

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 37

README

go-number

A golang number library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decimal

type Decimal struct {
	decimal.Decimal
}

func FromFloat

func FromFloat(source float64) Decimal

func FromString

func FromString(source string) Decimal

func NewDecimal

func NewDecimal(value int64, decimals int32) Decimal

func Zero

func Zero() Decimal

func (Decimal) Add

func (a Decimal) Add(b Decimal) Decimal

func (Decimal) Ceil

func (a Decimal) Ceil() Decimal

func (Decimal) Cmp

func (a Decimal) Cmp(b Decimal) int

func (Decimal) Div

func (a Decimal) Div(b Decimal) Decimal

func (Decimal) Divisible

func (a Decimal) Divisible(b Decimal) bool

func (Decimal) Equal

func (a Decimal) Equal(b Decimal) bool

func (Decimal) Exhausted

func (a Decimal) Exhausted() bool

func (Decimal) Float64

func (a Decimal) Float64() float64

func (Decimal) Floor

func (a Decimal) Floor() Decimal

func (Decimal) Integer

func (d Decimal) Integer(precision uint8) Integer

func (Decimal) Mul

func (a Decimal) Mul(b Decimal) Decimal

func (Decimal) Neg

func (a Decimal) Neg() Decimal

func (Decimal) Persist

func (a Decimal) Persist() string

func (Decimal) PresentCeil

func (a Decimal) PresentCeil() string

func (Decimal) PresentFloor

func (a Decimal) PresentFloor() string

func (Decimal) Round

func (a Decimal) Round(decimals int32) Decimal

func (Decimal) RoundCeil

func (a Decimal) RoundCeil(decimals int32) Decimal

func (Decimal) RoundFloor

func (a Decimal) RoundFloor(decimals int32) Decimal

func (Decimal) Source added in v0.1.1

func (a Decimal) Source() decimal.Decimal

func (Decimal) Sub

func (a Decimal) Sub(b Decimal) Decimal

type Integer

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

func NewInteger

func NewInteger(value int64, decimals uint8) Integer

func (Integer) Add

func (a Integer) Add(b Integer) Integer

func (Integer) Cmp

func (a Integer) Cmp(b Integer) int

func (Integer) Decimal

func (i Integer) Decimal() Decimal

func (Integer) Div

func (a Integer) Div(b Integer) Integer

func (Integer) IsNegative

func (a Integer) IsNegative() bool

func (Integer) IsPositive

func (a Integer) IsPositive() bool

func (Integer) IsZero

func (a Integer) IsZero() bool

func (Integer) MarshalJSON

func (i Integer) MarshalJSON() ([]byte, error)

func (Integer) Mul

func (a Integer) Mul(b Integer) Integer

func (Integer) Persist

func (i Integer) Persist() string

func (Integer) Precision

func (i Integer) Precision() uint8

func (Integer) Sub

func (a Integer) Sub(b Integer) Integer

func (Integer) Value

func (i Integer) Value() int64

func (Integer) Zero

func (i Integer) Zero() Integer

Jump to

Keyboard shortcuts

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