decimal

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScaleBytes

func ScaleBytes(s string, scale uint8) []byte

ScaleBytes converts a stringified decimal to a scaled byte slice

Types

type Decimal

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

Decimal represents decimal type in the Microsoft Open Specifications: http://msdn.microsoft.com/en-us/library/ee780893.aspx

func Float64ToDecimal

func Float64ToDecimal(f float64) (Decimal, error)

Float64ToDecimal converts float64 to decimal

func Float64ToDecimalScale

func Float64ToDecimalScale(f float64, scale uint8) (Decimal, error)

Float64ToDecimalScale converts float64 to decimal; user can specify the scale

func Int64ToDecimalScale

func Int64ToDecimalScale(v int64, scale uint8) Decimal

Int64ToDecimalScale converts float64 to decimal; user can specify the scale

func StringToDecimalScale

func StringToDecimalScale(v string, outScale uint8) (Decimal, error)

StringToDecimalScale converts string to decimal

func (Decimal) BigInt

func (d Decimal) BigInt() big.Int

BigInt converts decimal to a bigint

func (Decimal) Bytes

func (d Decimal) Bytes() []byte

Bytes converts decimal to a scaled byte slice

func (*Decimal) IsPositive

func (d *Decimal) IsPositive() bool

IsPositive returns true if the Decimal is positive

func (*Decimal) SetInteger

func (d *Decimal) SetInteger(integer uint32, ind uint8)

SetInteger sets the ind'th element in the integer array

func (*Decimal) SetPositive

func (d *Decimal) SetPositive(positive bool)

SetPositive sets the positive member

func (*Decimal) SetPrec

func (d *Decimal) SetPrec(prec uint8)

SetPrec sets the prec member

func (*Decimal) SetScale

func (d *Decimal) SetScale(scale uint8)

SetScale sets the scale member

func (Decimal) String

func (d Decimal) String() string

String converts decimal to a string

func (Decimal) ToFloat64

func (d Decimal) ToFloat64() float64

ToFloat64 converts decimal to a float64

func (Decimal) UnscaledBytes

func (d Decimal) UnscaledBytes() []byte

UnscaledBytes converts decimal to a unscaled byte slice

Jump to

Keyboard shortcuts

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