fixed

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: MPL-2.0 Imports: 9 Imported by: 4

Documentation

Overview

Package fixed provides fixed-point values that can be added, subtracted, multiplied and divided.

Index

Constants

View Source
const (
	// F64d2Max holds the maximum F64d2 value.
	F64d2Max = F64d2(1<<63 - 1)
	// F64d2Min holds the minimum F64d2 value.
	F64d2Min = F64d2(^(1<<63 - 1))
)
View Source
const (
	// F64d3Max holds the maximum F64d3 value.
	F64d3Max = F64d3(1<<63 - 1)
	// F64d3Min holds the minimum F64d3 value.
	F64d3Min = F64d3(^(1<<63 - 1))
)
View Source
const (
	// F64d4Max holds the maximum F64d4 value.
	F64d4Max = F64d4(1<<63 - 1)
	// F64d4Min holds the minimum F64d4 value.
	F64d4Min = F64d4(^(1<<63 - 1))
)
View Source
const (
	// F64d6Max holds the maximum F64d6 value.
	F64d6Max = F64d6(1<<63 - 1)
	// F64d6Min holds the minimum F64d6 value.
	F64d6Min = F64d6(^(1<<63 - 1))
)

Variables

View Source
var (
	// F128d16Max holds the maximum F128d16 value.
	F128d16Max = F128d16{/* contains filtered or unexported fields */}
	// F128d16Min holds the minimum F128d16 value.
	F128d16Min = F128d16{/* contains filtered or unexported fields */}
)
View Source
var (
	// F128d2Max holds the maximum F128d2 value.
	F128d2Max = F128d2{/* contains filtered or unexported fields */}
	// F128d2Min holds the minimum F128d2 value.
	F128d2Min = F128d2{/* contains filtered or unexported fields */}
)
View Source
var (
	// F128d3Max holds the maximum F128d3 value.
	F128d3Max = F128d3{/* contains filtered or unexported fields */}
	// F128d3Min holds the minimum F128d3 value.
	F128d3Min = F128d3{/* contains filtered or unexported fields */}
)
View Source
var (
	// F128d4Max holds the maximum F128d4 value.
	F128d4Max = F128d4{/* contains filtered or unexported fields */}
	// F128d4Min holds the minimum F128d4 value.
	F128d4Min = F128d4{/* contains filtered or unexported fields */}
)
View Source
var (
	// F128d6Max holds the maximum F128d6 value.
	F128d6Max = F128d6{/* contains filtered or unexported fields */}
	// F128d6Min holds the minimum F128d6 value.
	F128d6Min = F128d6{/* contains filtered or unexported fields */}
)

Functions

This section is empty.

Types

type F128d16 added in v1.9.0

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

F128d16 holds a fixed-point value that contains up to 16 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F128d16FromFloat64 added in v1.9.0

func F128d16FromFloat64(value float64) F128d16

F128d16FromFloat64 creates a new F128d16 value from a float64.

func F128d16FromInt64 added in v1.9.0

func F128d16FromInt64(value int64) F128d16

F128d16FromInt64 creates a new F128d16 value from an int64.

func F128d16FromString added in v1.9.0

func F128d16FromString(str string) (F128d16, error)

F128d16FromString creates a new F128d16 value from a string.

func F128d16FromStringForced added in v1.9.0

func F128d16FromStringForced(str string) F128d16

F128d16FromStringForced creates a new F128d16 value from a string.

func (F128d16) Add added in v1.9.0

func (f F128d16) Add(value F128d16) F128d16

Add adds this value to the passed-in value, returning a new value.

func (F128d16) AsFloat64 added in v1.9.2

func (f F128d16) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F128d16) AsInt64 added in v1.9.2

func (f F128d16) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F128d16) Comma added in v1.9.0

func (f F128d16) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F128d16) Div added in v1.9.0

func (f F128d16) Div(value F128d16) F128d16

Div divides this value by the passed-in value, returning a new value.

func (F128d16) Float64 added in v1.9.0

func (f F128d16) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F128d16) Int64 added in v1.9.0

func (f F128d16) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F128d16) MarshalJSON added in v1.9.0

func (f F128d16) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F128d16) MarshalText added in v1.9.0

func (f F128d16) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F128d16) MarshalYAML added in v1.9.0

func (f F128d16) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F128d16) Mul added in v1.9.0

func (f F128d16) Mul(value F128d16) F128d16

Mul multiplies this value by the passed-in value, returning a new value.

func (F128d16) String added in v1.9.0

func (f F128d16) String() string

func (F128d16) Sub added in v1.9.0

func (f F128d16) Sub(value F128d16) F128d16

Sub subtracts the passed-in value from this value, returning a new value.

func (F128d16) Trunc added in v1.9.0

func (f F128d16) Trunc() F128d16

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F128d16) UnmarshalJSON added in v1.9.0

func (f *F128d16) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F128d16) UnmarshalText added in v1.9.0

func (f *F128d16) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F128d16) UnmarshalYAML added in v1.9.0

func (f *F128d16) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F128d2 added in v1.9.0

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

F128d2 holds a fixed-point value that contains up to 2 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F128d2FromFloat64 added in v1.9.0

func F128d2FromFloat64(value float64) F128d2

F128d2FromFloat64 creates a new F128d2 value from a float64.

func F128d2FromInt64 added in v1.9.0

func F128d2FromInt64(value int64) F128d2

F128d2FromInt64 creates a new F128d2 value from an int64.

func F128d2FromString added in v1.9.0

func F128d2FromString(str string) (F128d2, error)

F128d2FromString creates a new F128d2 value from a string.

func F128d2FromStringForced added in v1.9.0

func F128d2FromStringForced(str string) F128d2

F128d2FromStringForced creates a new F128d2 value from a string.

func (F128d2) Add added in v1.9.0

func (f F128d2) Add(value F128d2) F128d2

Add adds this value to the passed-in value, returning a new value.

func (F128d2) AsFloat64 added in v1.9.2

func (f F128d2) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F128d2) AsInt64 added in v1.9.2

func (f F128d2) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F128d2) Comma added in v1.9.0

func (f F128d2) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F128d2) Div added in v1.9.0

func (f F128d2) Div(value F128d2) F128d2

Div divides this value by the passed-in value, returning a new value.

func (F128d2) Float64 added in v1.9.0

func (f F128d2) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F128d2) Int64 added in v1.9.0

func (f F128d2) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F128d2) MarshalJSON added in v1.9.0

func (f F128d2) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F128d2) MarshalText added in v1.9.0

func (f F128d2) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F128d2) MarshalYAML added in v1.9.0

func (f F128d2) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F128d2) Mul added in v1.9.0

func (f F128d2) Mul(value F128d2) F128d2

Mul multiplies this value by the passed-in value, returning a new value.

func (F128d2) String added in v1.9.0

func (f F128d2) String() string

func (F128d2) Sub added in v1.9.0

func (f F128d2) Sub(value F128d2) F128d2

Sub subtracts the passed-in value from this value, returning a new value.

func (F128d2) Trunc added in v1.9.0

func (f F128d2) Trunc() F128d2

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F128d2) UnmarshalJSON added in v1.9.0

func (f *F128d2) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F128d2) UnmarshalText added in v1.9.0

func (f *F128d2) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F128d2) UnmarshalYAML added in v1.9.0

func (f *F128d2) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F128d3 added in v1.9.0

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

F128d3 holds a fixed-point value that contains up to 3 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F128d3FromFloat64 added in v1.9.0

func F128d3FromFloat64(value float64) F128d3

F128d3FromFloat64 creates a new F128d3 value from a float64.

func F128d3FromInt64 added in v1.9.0

func F128d3FromInt64(value int64) F128d3

F128d3FromInt64 creates a new F128d3 value from an int64.

func F128d3FromString added in v1.9.0

func F128d3FromString(str string) (F128d3, error)

F128d3FromString creates a new F128d3 value from a string.

func F128d3FromStringForced added in v1.9.0

func F128d3FromStringForced(str string) F128d3

F128d3FromStringForced creates a new F128d3 value from a string.

func (F128d3) Add added in v1.9.0

func (f F128d3) Add(value F128d3) F128d3

Add adds this value to the passed-in value, returning a new value.

func (F128d3) AsFloat64 added in v1.9.2

func (f F128d3) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F128d3) AsInt64 added in v1.9.2

func (f F128d3) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F128d3) Comma added in v1.9.0

func (f F128d3) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F128d3) Div added in v1.9.0

func (f F128d3) Div(value F128d3) F128d3

Div divides this value by the passed-in value, returning a new value.

func (F128d3) Float64 added in v1.9.0

func (f F128d3) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F128d3) Int64 added in v1.9.0

func (f F128d3) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F128d3) MarshalJSON added in v1.9.0

func (f F128d3) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F128d3) MarshalText added in v1.9.0

func (f F128d3) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F128d3) MarshalYAML added in v1.9.0

func (f F128d3) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F128d3) Mul added in v1.9.0

func (f F128d3) Mul(value F128d3) F128d3

Mul multiplies this value by the passed-in value, returning a new value.

func (F128d3) String added in v1.9.0

func (f F128d3) String() string

func (F128d3) Sub added in v1.9.0

func (f F128d3) Sub(value F128d3) F128d3

Sub subtracts the passed-in value from this value, returning a new value.

func (F128d3) Trunc added in v1.9.0

func (f F128d3) Trunc() F128d3

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F128d3) UnmarshalJSON added in v1.9.0

func (f *F128d3) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F128d3) UnmarshalText added in v1.9.0

func (f *F128d3) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F128d3) UnmarshalYAML added in v1.9.0

func (f *F128d3) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F128d4 added in v1.9.0

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

F128d4 holds a fixed-point value that contains up to 4 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F128d4FromFloat64 added in v1.9.0

func F128d4FromFloat64(value float64) F128d4

F128d4FromFloat64 creates a new F128d4 value from a float64.

func F128d4FromInt64 added in v1.9.0

func F128d4FromInt64(value int64) F128d4

F128d4FromInt64 creates a new F128d4 value from an int64.

func F128d4FromString added in v1.9.0

func F128d4FromString(str string) (F128d4, error)

F128d4FromString creates a new F128d4 value from a string.

func F128d4FromStringForced added in v1.9.0

func F128d4FromStringForced(str string) F128d4

F128d4FromStringForced creates a new F128d4 value from a string.

func (F128d4) Add added in v1.9.0

func (f F128d4) Add(value F128d4) F128d4

Add adds this value to the passed-in value, returning a new value.

func (F128d4) AsFloat64 added in v1.9.2

func (f F128d4) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F128d4) AsInt64 added in v1.9.2

func (f F128d4) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F128d4) Comma added in v1.9.0

func (f F128d4) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F128d4) Div added in v1.9.0

func (f F128d4) Div(value F128d4) F128d4

Div divides this value by the passed-in value, returning a new value.

func (F128d4) Float64 added in v1.9.0

func (f F128d4) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F128d4) Int64 added in v1.9.0

func (f F128d4) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F128d4) MarshalJSON added in v1.9.0

func (f F128d4) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F128d4) MarshalText added in v1.9.0

func (f F128d4) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F128d4) MarshalYAML added in v1.9.0

func (f F128d4) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F128d4) Mul added in v1.9.0

func (f F128d4) Mul(value F128d4) F128d4

Mul multiplies this value by the passed-in value, returning a new value.

func (F128d4) String added in v1.9.0

func (f F128d4) String() string

func (F128d4) Sub added in v1.9.0

func (f F128d4) Sub(value F128d4) F128d4

Sub subtracts the passed-in value from this value, returning a new value.

func (F128d4) Trunc added in v1.9.0

func (f F128d4) Trunc() F128d4

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F128d4) UnmarshalJSON added in v1.9.0

func (f *F128d4) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F128d4) UnmarshalText added in v1.9.0

func (f *F128d4) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F128d4) UnmarshalYAML added in v1.9.0

func (f *F128d4) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F128d6 added in v1.9.0

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

F128d6 holds a fixed-point value that contains up to 6 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F128d6FromFloat64 added in v1.9.0

func F128d6FromFloat64(value float64) F128d6

F128d6FromFloat64 creates a new F128d6 value from a float64.

func F128d6FromInt64 added in v1.9.0

func F128d6FromInt64(value int64) F128d6

F128d6FromInt64 creates a new F128d6 value from an int64.

func F128d6FromString added in v1.9.0

func F128d6FromString(str string) (F128d6, error)

F128d6FromString creates a new F128d6 value from a string.

func F128d6FromStringForced added in v1.9.0

func F128d6FromStringForced(str string) F128d6

F128d6FromStringForced creates a new F128d6 value from a string.

func (F128d6) Add added in v1.9.0

func (f F128d6) Add(value F128d6) F128d6

Add adds this value to the passed-in value, returning a new value.

func (F128d6) AsFloat64 added in v1.9.2

func (f F128d6) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F128d6) AsInt64 added in v1.9.2

func (f F128d6) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F128d6) Comma added in v1.9.0

func (f F128d6) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F128d6) Div added in v1.9.0

func (f F128d6) Div(value F128d6) F128d6

Div divides this value by the passed-in value, returning a new value.

func (F128d6) Float64 added in v1.9.0

func (f F128d6) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F128d6) Int64 added in v1.9.0

func (f F128d6) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F128d6) MarshalJSON added in v1.9.0

func (f F128d6) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F128d6) MarshalText added in v1.9.0

func (f F128d6) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F128d6) MarshalYAML added in v1.9.0

func (f F128d6) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F128d6) Mul added in v1.9.0

func (f F128d6) Mul(value F128d6) F128d6

Mul multiplies this value by the passed-in value, returning a new value.

func (F128d6) String added in v1.9.0

func (f F128d6) String() string

func (F128d6) Sub added in v1.9.0

func (f F128d6) Sub(value F128d6) F128d6

Sub subtracts the passed-in value from this value, returning a new value.

func (F128d6) Trunc added in v1.9.0

func (f F128d6) Trunc() F128d6

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F128d6) UnmarshalJSON added in v1.9.0

func (f *F128d6) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F128d6) UnmarshalText added in v1.9.0

func (f *F128d6) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F128d6) UnmarshalYAML added in v1.9.0

func (f *F128d6) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F64d2 added in v1.9.0

type F64d2 int64

F64d2 holds a fixed-point value that contains up to 2 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F64d2FromFloat64 added in v1.9.0

func F64d2FromFloat64(value float64) F64d2

F64d2FromFloat64 creates a new F64d2 value from a float64.

func F64d2FromInt64 added in v1.9.0

func F64d2FromInt64(value int64) F64d2

F64d2FromInt64 creates a new F64d2 value from an int64.

func F64d2FromString added in v1.9.0

func F64d2FromString(str string) (F64d2, error)

F64d2FromString creates a new F64d2 value from a string.

func F64d2FromStringForced added in v1.9.0

func F64d2FromStringForced(str string) F64d2

F64d2FromStringForced creates a new F64d2 value from a string.

func (F64d2) AsFloat64 added in v1.9.2

func (f F64d2) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F64d2) AsInt64 added in v1.9.2

func (f F64d2) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F64d2) Comma added in v1.9.0

func (f F64d2) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F64d2) Div added in v1.9.0

func (f F64d2) Div(value F64d2) F64d2

Div divides this value by the passed-in value, returning a new value.

func (F64d2) Float64 added in v1.9.0

func (f F64d2) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F64d2) Int64 added in v1.9.0

func (f F64d2) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F64d2) MarshalJSON added in v1.9.0

func (f F64d2) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F64d2) MarshalText added in v1.9.0

func (f F64d2) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F64d2) MarshalYAML added in v1.9.0

func (f F64d2) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F64d2) Mul added in v1.9.0

func (f F64d2) Mul(value F64d2) F64d2

Mul multiplies this value by the passed-in value, returning a new value.

func (F64d2) String added in v1.9.0

func (f F64d2) String() string

func (F64d2) Trunc added in v1.9.0

func (f F64d2) Trunc() F64d2

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F64d2) UnmarshalJSON added in v1.9.0

func (f *F64d2) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F64d2) UnmarshalText added in v1.9.0

func (f *F64d2) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F64d2) UnmarshalYAML added in v1.9.0

func (f *F64d2) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F64d3 added in v1.9.0

type F64d3 int64

F64d3 holds a fixed-point value that contains up to 3 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F64d3FromFloat64 added in v1.9.0

func F64d3FromFloat64(value float64) F64d3

F64d3FromFloat64 creates a new F64d3 value from a float64.

func F64d3FromInt64 added in v1.9.0

func F64d3FromInt64(value int64) F64d3

F64d3FromInt64 creates a new F64d3 value from an int64.

func F64d3FromString added in v1.9.0

func F64d3FromString(str string) (F64d3, error)

F64d3FromString creates a new F64d3 value from a string.

func F64d3FromStringForced added in v1.9.0

func F64d3FromStringForced(str string) F64d3

F64d3FromStringForced creates a new F64d3 value from a string.

func (F64d3) AsFloat64 added in v1.9.2

func (f F64d3) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F64d3) AsInt64 added in v1.9.2

func (f F64d3) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F64d3) Comma added in v1.9.0

func (f F64d3) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F64d3) Div added in v1.9.0

func (f F64d3) Div(value F64d3) F64d3

Div divides this value by the passed-in value, returning a new value.

func (F64d3) Float64 added in v1.9.0

func (f F64d3) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F64d3) Int64 added in v1.9.0

func (f F64d3) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F64d3) MarshalJSON added in v1.9.0

func (f F64d3) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F64d3) MarshalText added in v1.9.0

func (f F64d3) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F64d3) MarshalYAML added in v1.9.0

func (f F64d3) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F64d3) Mul added in v1.9.0

func (f F64d3) Mul(value F64d3) F64d3

Mul multiplies this value by the passed-in value, returning a new value.

func (F64d3) String added in v1.9.0

func (f F64d3) String() string

func (F64d3) Trunc added in v1.9.0

func (f F64d3) Trunc() F64d3

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F64d3) UnmarshalJSON added in v1.9.0

func (f *F64d3) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F64d3) UnmarshalText added in v1.9.0

func (f *F64d3) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F64d3) UnmarshalYAML added in v1.9.0

func (f *F64d3) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F64d4 added in v1.9.0

type F64d4 int64

F64d4 holds a fixed-point value that contains up to 4 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F64d4FromFloat64 added in v1.9.0

func F64d4FromFloat64(value float64) F64d4

F64d4FromFloat64 creates a new F64d4 value from a float64.

func F64d4FromInt64 added in v1.9.0

func F64d4FromInt64(value int64) F64d4

F64d4FromInt64 creates a new F64d4 value from an int64.

func F64d4FromString added in v1.9.0

func F64d4FromString(str string) (F64d4, error)

F64d4FromString creates a new F64d4 value from a string.

func F64d4FromStringForced added in v1.9.0

func F64d4FromStringForced(str string) F64d4

F64d4FromStringForced creates a new F64d4 value from a string.

func (F64d4) AsFloat64 added in v1.9.2

func (f F64d4) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F64d4) AsInt64 added in v1.9.2

func (f F64d4) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F64d4) Comma added in v1.9.0

func (f F64d4) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F64d4) Div added in v1.9.0

func (f F64d4) Div(value F64d4) F64d4

Div divides this value by the passed-in value, returning a new value.

func (F64d4) Float64 added in v1.9.0

func (f F64d4) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F64d4) Int64 added in v1.9.0

func (f F64d4) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F64d4) MarshalJSON added in v1.9.0

func (f F64d4) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F64d4) MarshalText added in v1.9.0

func (f F64d4) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F64d4) MarshalYAML added in v1.9.0

func (f F64d4) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F64d4) Mul added in v1.9.0

func (f F64d4) Mul(value F64d4) F64d4

Mul multiplies this value by the passed-in value, returning a new value.

func (F64d4) String added in v1.9.0

func (f F64d4) String() string

func (F64d4) Trunc added in v1.9.0

func (f F64d4) Trunc() F64d4

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F64d4) UnmarshalJSON added in v1.9.0

func (f *F64d4) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F64d4) UnmarshalText added in v1.9.0

func (f *F64d4) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F64d4) UnmarshalYAML added in v1.9.0

func (f *F64d4) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type F64d6 added in v1.9.0

type F64d6 int64

F64d6 holds a fixed-point value that contains up to 6 decimal places. Values are truncated, not rounded. Values can be added and subtracted directly. For multiplication and division, the provided Mul() and Div() methods should be used.

func F64d6FromFloat64 added in v1.9.0

func F64d6FromFloat64(value float64) F64d6

F64d6FromFloat64 creates a new F64d6 value from a float64.

func F64d6FromInt64 added in v1.9.0

func F64d6FromInt64(value int64) F64d6

F64d6FromInt64 creates a new F64d6 value from an int64.

func F64d6FromString added in v1.9.0

func F64d6FromString(str string) (F64d6, error)

F64d6FromString creates a new F64d6 value from a string.

func F64d6FromStringForced added in v1.9.0

func F64d6FromStringForced(str string) F64d6

F64d6FromStringForced creates a new F64d6 value from a string.

func (F64d6) AsFloat64 added in v1.9.2

func (f F64d6) AsFloat64() float64

AsFloat64 returns the floating-point equivalent to this value.

func (F64d6) AsInt64 added in v1.9.2

func (f F64d6) AsInt64() int64

AsInt64 returns the truncated equivalent integer to this value.

func (F64d6) Comma added in v1.9.0

func (f F64d6) Comma() string

Comma returns the same as String(), but with commas for values of 1000 and greater.

func (F64d6) Div added in v1.9.0

func (f F64d6) Div(value F64d6) F64d6

Div divides this value by the passed-in value, returning a new value.

func (F64d6) Float64 added in v1.9.0

func (f F64d6) Float64() (float64, error)

Float64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with a float64, as we never want to emit inexact floating point values into json for fixed-point values.

func (F64d6) Int64 added in v1.9.0

func (f F64d6) Int64() (int64, error)

Int64 implements json.Number. Intentionally returns an error if the value cannot be represented exactly with an int64, as we never want to emit inexact values into json for fixed-point values.

func (F64d6) MarshalJSON added in v1.9.0

func (f F64d6) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (F64d6) MarshalText added in v1.9.0

func (f F64d6) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (F64d6) MarshalYAML added in v1.9.0

func (f F64d6) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (F64d6) Mul added in v1.9.0

func (f F64d6) Mul(value F64d6) F64d6

Mul multiplies this value by the passed-in value, returning a new value.

func (F64d6) String added in v1.9.0

func (f F64d6) String() string

func (F64d6) Trunc added in v1.9.0

func (f F64d6) Trunc() F64d6

Trunc returns a new value which has everything to the right of the decimal place truncated.

func (*F64d6) UnmarshalJSON added in v1.9.0

func (f *F64d6) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*F64d6) UnmarshalText added in v1.9.0

func (f *F64d6) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*F64d6) UnmarshalYAML added in v1.9.0

func (f *F64d6) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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