fixed

package
v0.0.0-...-f82ba6c Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixed

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

Fixed is a four decimal place fixed data type

func FromFixed

func FromFixed(v Fixed) Fixed

FromFixed clones a Fixed

func FromFloat64

func FromFloat64(v float64) Fixed

FromFloat64 creats a Fixed from a float64

func FromInt

func FromInt(v int) Fixed

FromInt creates a Fixed from an int

func FromInt64

func FromInt64(v int64) Fixed

FromInt64 creates a Fixed from an int64

func FromString

func FromString(value string) (Fixed, error)

FromString creates a Fixed from a string

func (*Fixed) Add

func (f *Fixed) Add(b Fixed) Fixed

Add adds two Fixed

func (*Fixed) Compare

func (f *Fixed) Compare(b Fixed) int

Compare compares two Fixed

func (*Fixed) Div

func (f *Fixed) Div(b Fixed) Fixed

Div divides two Fixed

func (*Fixed) Fix

func (f *Fixed) Fix(decimals int) error

Fix truncates a Fixed to decimal places

func (*Fixed) Mul

func (f *Fixed) Mul(b Fixed) Fixed

Mul multiplies two Fixed

func (*Fixed) Round

func (f *Fixed) Round(decimals int) error

Round rounds a Fixed to decimal places

func (*Fixed) Sub

func (f *Fixed) Sub(b Fixed) Fixed

Sub subtracts two Fixed

func (*Fixed) ToDollars

func (f *Fixed) ToDollars() string

ToDollars returns Fixed as a dollar amount

func (*Fixed) ToString

func (f *Fixed) ToString(decimals int, sep byte, width int) string

ToString outputs fixed as string with decimals, optional separator left padded to width

func (*Fixed) ToWords

func (f *Fixed) ToWords() string

ToWords outputs Fixed as English words

Jump to

Keyboard shortcuts

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