Documentation
¶
Index ¶
- Constants
- type Gyro
- func New(coeff i128.I128, exp int32) Gyro
- func NewFromInt32Raw(coeff int32, exp int32) Gyro
- func NewFromInt64(coeff int64) Gyro
- func NewFromInt64Raw(coeff int64, exp int32) Gyro
- func NewFromString(s string) (Gyro, error)
- func NewHundred() Gyro
- func NewMinusOne() Gyro
- func NewOne() Gyro
- func NewTen() Gyro
- func NewZero() Gyro
- func (g Gyro) Abs() Gyro
- func (g Gyro) Add(g2 Gyro) Gyro
- func (g Gyro) Cmp(g2 Gyro) int
- func (g Gyro) Div(g2 Gyro) Gyro
- func (g Gyro) DivRound(g2 Gyro, scale int32) Gyro
- func (g Gyro) Equal(other Gyro) bool
- func (g Gyro) Float64() float64
- func (g Gyro) Int64() int64
- func (g Gyro) IsFloat64Exact() bool
- func (g Gyro) Mul(g2 Gyro) Gyro
- func (g Gyro) QuoRem(g2 Gyro, precision int32) (Gyro, Gyro)
- func (g Gyro) Round(places int32) Gyro
- func (g Gyro) String() string
- func (g Gyro) Sub(g2 Gyro) Gyro
- type GyroErr
- type GyroExponentNANErr
- type GyroFractionalTooLongErr
- type GyroInvalidErr
- type GyroOverflowErr
- type GyroTooManyDecimals
Constants ¶
const ( MaxScale = 16 MaxDivisionScale = 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gyro ¶
type Gyro struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new Gyro with the given coefficient and exponent. if exp greater than maxScale, it will be clamped to maxScale. if exp is positive, will multiply the coefficient by 10^exp.
func NewFromInt32Raw ¶
NewFromInt32Raw returns a new Gyro with the given int32 coefficient and exponent.
func NewFromInt64 ¶
func NewFromInt64Raw ¶
NewFromInt64Raw returns a new Gyro with the given coefficient and exponent.
func NewFromString ¶
NewFromString returns a string representation of a Gyro Decimal
func NewHundred ¶ added in v1.0.1
func NewHundred() Gyro
func NewMinusOne ¶ added in v1.0.1
func NewMinusOne() Gyro
func (Gyro) Cmp ¶
Cmp compares the numbers represented by d and d2 and returns:
-1 if d < d2 0 if d == d2 +1 if d > d2
func (Gyro) Div ¶ added in v1.0.2
Div returns the quotient of two Gyros. Uses MaxDivisionScale digits of precision.
func (Gyro) DivRound ¶
DivRound divides two Gyros and rounds the result to the given scale. Do not use over MaxDivisionScale digits of precision.
func (Gyro) IsFloat64Exact ¶
type GyroExponentNANErr ¶
type GyroExponentNANErr struct {
*GyroErr
}
func NewGyroExponentNANErr ¶
func NewGyroExponentNANErr(info any) *GyroExponentNANErr
type GyroFractionalTooLongErr ¶
type GyroFractionalTooLongErr struct {
*GyroErr
}
func NewGyroFractionalTooLongErr ¶
func NewGyroFractionalTooLongErr(info any) *GyroFractionalTooLongErr
type GyroInvalidErr ¶
type GyroInvalidErr struct {
*GyroErr
}
type GyroOverflowErr ¶
type GyroOverflowErr struct {
*GyroErr
}
func NewGyroInvalidErr ¶
func NewGyroInvalidErr(info any) *GyroOverflowErr
func NewGyroOverflowErr ¶
func NewGyroOverflowErr(info any) *GyroOverflowErr
type GyroTooManyDecimals ¶
type GyroTooManyDecimals struct {
*GyroErr
}
func NewGyroTooManyDecimals ¶
func NewGyroTooManyDecimals(info any) *GyroTooManyDecimals