Documentation
¶
Overview ¶
Code generated by generators/genConstants.py; DO NOT EDIT.
Index ¶
- Constants
- Variables
- type DivisionByZeroError
- type Fix128
- func (a Fix128) Abs() (UFix128, int64)
- func (a Fix128) Add(b Fix128) (Fix128, error)
- func (a Fix128) Cos() (Fix128, error)
- func (a Fix128) Div(b Fix128, round RoundingMode) (Fix128, error)
- func (a Fix128) Eq(b Fix128) bool
- func (a Fix128) Exp() (UFix128, error)
- func (a Fix128) FMD(b, c Fix128, round RoundingMode) (Fix128, error)
- func (a Fix128) Gt(b Fix128) bool
- func (a Fix128) Gte(b Fix128) bool
- func (a Fix128) IsNeg() bool
- func (a Fix128) IsZero() bool
- func (a Fix128) Lt(b Fix128) bool
- func (a Fix128) Lte(b Fix128) bool
- func (a Fix128) Mod(b Fix128) (Fix128, error)
- func (a Fix128) Mul(b Fix128, round RoundingMode) (Fix128, error)
- func (a Fix128) Neg() (Fix128, error)
- func (a Fix128) Sin() (Fix128, error)
- func (a Fix128) Sub(b Fix128) (Fix128, error)
- func (a Fix128) ToFix64(round RoundingMode) (Fix64, error)
- type Fix64
- func (a Fix64) Abs() (UFix64, int64)
- func (a Fix64) Add(b Fix64) (Fix64, error)
- func (a Fix64) Cos() (Fix64, error)
- func (a Fix64) Div(b Fix64, round RoundingMode) (Fix64, error)
- func (a Fix64) Eq(b Fix64) bool
- func (a Fix64) Exp() (UFix64, error)
- func (a Fix64) FMD(b, c Fix64, round RoundingMode) (Fix64, error)
- func (a Fix64) Gt(b Fix64) bool
- func (a Fix64) Gte(b Fix64) bool
- func (a Fix64) IsNeg() bool
- func (a Fix64) IsZero() bool
- func (a Fix64) Lt(b Fix64) bool
- func (a Fix64) Lte(b Fix64) bool
- func (a Fix64) Mod(b Fix64) (Fix64, error)
- func (a Fix64) Mul(b Fix64, round RoundingMode) (Fix64, error)
- func (a Fix64) Neg() (Fix64, error)
- func (a Fix64) Sin() (Fix64, error)
- func (a Fix64) Sub(b Fix64) (Fix64, error)
- func (a Fix64) ToFix128() Fix128
- type NegativeOverflowError
- type OutOfDomainErrorError
- type PositiveOverflowError
- type RoundingMode
- type UFix128
- func (a UFix128) Add(b UFix128) (UFix128, error)
- func (a UFix128) ApplySign(sign int64) (Fix128, error)
- func (a UFix128) Div(b UFix128, round RoundingMode) (UFix128, error)
- func (a UFix128) Eq(b UFix128) bool
- func (a UFix128) FMD(b, c UFix128, round RoundingMode) (UFix128, error)
- func (a UFix128) Gt(b UFix128) bool
- func (a UFix128) Gte(b UFix128) bool
- func (a UFix128) IsZero() bool
- func (a UFix128) Ln() (Fix128, error)
- func (a UFix128) Lt(b UFix128) bool
- func (a UFix128) Lte(b UFix128) bool
- func (a UFix128) Mod(b UFix128) (UFix128, error)
- func (a UFix128) Mul(b UFix128, round RoundingMode) (UFix128, error)
- func (a UFix128) Pow(b Fix128) (UFix128, error)
- func (a UFix128) Sqrt(round RoundingMode) (UFix128, error)
- func (a UFix128) Sub(b UFix128) (UFix128, error)
- func (a UFix128) ToUFix64(round RoundingMode) (UFix64, error)
- type UFix64
- func (a UFix64) Add(b UFix64) (UFix64, error)
- func (a UFix64) ApplySign(sign int64) (Fix64, error)
- func (a UFix64) Div(b UFix64, round RoundingMode) (UFix64, error)
- func (a UFix64) Eq(b UFix64) bool
- func (a UFix64) FMD(b, c UFix64, round RoundingMode) (UFix64, error)
- func (a UFix64) Gt(b UFix64) bool
- func (a UFix64) Gte(b UFix64) bool
- func (a UFix64) IsZero() bool
- func (a UFix64) Ln() (Fix64, error)
- func (a UFix64) Lt(b UFix64) bool
- func (a UFix64) Lte(b UFix64) bool
- func (a UFix64) Mod(b UFix64) (UFix64, error)
- func (a UFix64) Mul(b UFix64, round RoundingMode) (UFix64, error)
- func (a UFix64) Pow(b Fix64) (UFix64, error)
- func (a UFix64) Sqrt(round RoundingMode) (UFix64, error)
- func (a UFix64) Sub(b UFix64) (UFix64, error)
- func (a UFix64) ToUFix128() UFix128
- type UnderflowError
Constants ¶
const ( // The Div, Mul, and FMD functions support four rounding modes: // RoundTowardZero: Returns the closest representable fixed-point value that has a magnitude // less than or equal to the magnitude of the real result, effectively truncating the // fractional part. e.g. 5e-8 / 2 = 2e-8, -5e-8 / 2 = -2e-8 // RoundAwayFromZero: Returns the closest representable fixed-point value that has a magnitude // greater than or equal to the magnitude of the real result, effectively rounding up // any fractional part. e.g. 5e-8 / 2 = 3e-8, -5e-8 / 2 = -3e-8 // RoundNearestHalfAway: Returns the closest representable fixed-point value to the real result, // which could be larger (rounded up) or smaller (rounded down) depending on if the // unrepresentable portion is greater than or less than one half the difference between two // available values. If two representable values are equally close, the value will be rounded // away from zero. e.g. 7e-8 / 2 = 4e-8, 5e-8 / 2 = 3e-8 // RoundNearestHalfEven: Returns the closest representable fixed-point value to the real result, // which could be larger (rounded up) or smaller (rounded down) depending on if the // unrepresentable portion is greater than or less than one half the difference between two // available values. If two representable values are equally close, the value with an even // digit in the smallest decimal place will be chosen. e.g. 7e-8 / 2 = 4e-8, 5e-8 / 2 = 2e-8 // // Note that for ALL rounding modes when using signed inputs, the absolute value of the result // will be the same regardless of the sign of the inputs. // // In other words, for all rounding modes: abs(x / y) == abs(-x / y) == abs(x / -y) == abs(-x / -y) RoundTowardZero RoundingMode = iota RoundAwayFromZero RoundNearestHalfAway RoundNearestHalfEven RoundTruncate = RoundTowardZero RoundDown = RoundTowardZero RoundUp = RoundAwayFromZero RoundHalfUp = RoundNearestHalfAway RoundHalfEven = RoundNearestHalfEven )
const Fix128OneLeadingZeros = 48 // Number of leading zero bits for Fix128One
const Fix128Scale = 1E+24 // NOTE: Bigger than uint64! Mostly here as documentation...
Basic constants for Fix128 and UFix128
const Fix64HalfPi = Fix64(0x00000000095cd851)
const Fix64Max = Fix64(0x7fffffffffffffff) // Max value for Fix64
const Fix64Min = Fix64(0x8000000000000000) // Min value for Fix64
const Fix64One = Fix64(1 * Fix64Scale) // 1 in fix64
const Fix64OneLeadingZeros = 37 // Number of leading zero bits for Fix64One
const Fix64Pi = Fix64(0x0000000012b9b0a1)
Transcendental constants
const Fix64Scale = 1E+8
Basic constants for Fix64 and UFix64
const Fix64TwoPi = Fix64(0x0000000025736143)
const Fix64Zero = Fix64(0)
const UFix64Max = UFix64(0xffffffffffffffff) // Max value for UFix64
const UFix64One = UFix64(1 * Fix64Scale) // 1 in fix64
const UFix64Zero = UFix64(0)
Variables ¶
var Fix128HalfPi = Fix128{Hi: 0x0000000000014ca1, Lo: 0x0a1cd055eb96585a}
var Fix128Max = Fix128{Hi: 0x7fffffffffffffff, Lo: 0xffffffffffffffff}
var Fix128Min = Fix128{Hi: 0x8000000000000000, Lo: 0x0000000000000000}
var Fix128One = Fix128{Hi: 0x000000000000d3c2, Lo: 0x1bcecceda1000000}
var Fix128Pi = Fix128{Hi: 0x0000000000029942, Lo: 0x1439a0abd72cb0b3}
var Fix128TwoPi = Fix128{Hi: 0x0000000000053284, Lo: 0x28734157ae596167}
var Fix128Zero = Fix128{Hi: 0x0000000000000000, Lo: 0x0000000000000000}
var UFix128Max = UFix128{Hi: 0xffffffffffffffff, Lo: 0xffffffffffffffff}
var UFix128One = UFix128{Hi: 0x000000000000d3c2, Lo: 0x1bcecceda1000000}
var UFix128Zero = UFix128{Hi: 0x0000000000000000, Lo: 0x0000000000000000}
Functions ¶
This section is empty.
Types ¶
type DivisionByZeroError ¶
type DivisionByZeroError struct{}
func (DivisionByZeroError) Error ¶
func (DivisionByZeroError) Error() string
type Fix128 ¶
type Fix128 raw128
func (Fix128) Abs ¶
Abs returns the absolute value of `a` as an unsigned value, with a sign value as an int64. Note that this method works properly for Fix128Min, which can NOT be represented as a positive Fix128.
func (Fix128) Add ¶
Add returns the sum of `a` and `b`, or an error on overflow or negative overflow.
func (Fix128) Div ¶
func (a Fix128) Div(b Fix128, round RoundingMode) (Fix128, error)
Div returns the quotient of `a` and `b`, or an error on division by zero, overflow, or underflow.
func (Fix128) Exp ¶
Exp(a) returns `e^a`, or an error on overflow or underflow. Note that although the input is a Fix128, the output is a UFix128, since `e^a` is always positive.
func (Fix128) FMD ¶
func (a Fix128) FMD(b, c Fix128, round RoundingMode) (Fix128, error)
FMD returns `a*b/c` without intermediate rounding, or an error on division by zero, overflow, or underflow.
func (Fix128) Mod ¶
Mod returns the remainder of `a` divided by `b`, the result matches the sign of `a` (as per Go's % operator).
func (Fix128) Mul ¶
func (a Fix128) Mul(b Fix128, round RoundingMode) (Fix128, error)
Mul returns the product of `a` and `b`, or an error on overflow or underflow.
type Fix64 ¶
type Fix64 raw64
func (Fix64) Abs ¶
Abs returns the absolute value of `a` as an unsigned value, with a sign value as an int64. Note that this method works properly for Fix64Min, which can NOT be represented as a positive Fix64.
func (Fix64) Add ¶
Add returns the sum of `a` and `b`, or an error on overflow or negative overflow.
func (Fix64) Div ¶
func (a Fix64) Div(b Fix64, round RoundingMode) (Fix64, error)
Div returns the quotient of `a` and `b`, or an error on division by zero, overflow, or underflow.
func (Fix64) Exp ¶
Exp(a) returns `e^a`, or an error on overflow or underflow. Note that although the input is a Fix64, the output is a UFix64, since `e^a` is always positive.
func (Fix64) FMD ¶
func (a Fix64) FMD(b, c Fix64, round RoundingMode) (Fix64, error)
FMD returns `a*b/c` without intermediate rounding, or an error on division by zero, overflow, or underflow.
func (Fix64) Mod ¶
Mod returns the remainder of `a` divided by `b`, the result matches the sign of `a` (as per Go's % operator).
func (Fix64) Mul ¶
func (a Fix64) Mul(b Fix64, round RoundingMode) (Fix64, error)
Mul returns the product of `a` and `b`, or an error on overflow or underflow.
type NegativeOverflowError ¶
type NegativeOverflowError struct{}
NegativeOverflowError is reported when the value is negative and has a magnitude that is too large to be represented using the given bit length.
func (NegativeOverflowError) Error ¶
func (NegativeOverflowError) Error() string
type OutOfDomainErrorError ¶
type OutOfDomainErrorError struct{}
func (OutOfDomainErrorError) Error ¶
func (OutOfDomainErrorError) Error() string
type PositiveOverflowError ¶
type PositiveOverflowError struct{}
PositiveOverflowError is reported when the value is positive and has a magnitude that is too large to be represented using the given bit length.
func (PositiveOverflowError) Error ¶
func (PositiveOverflowError) Error() string
type UFix128 ¶
type UFix128 raw128
func NewUFix128 ¶
func (UFix128) ApplySign ¶
ApplySign converts a UFix128 to a Fix128, applying the sign specified by the input.
func (UFix128) Div ¶
func (a UFix128) Div(b UFix128, round RoundingMode) (UFix128, error)
Div returns the quotient of `a` and `b`, or an error on division by zero, overflow, or underflow.
func (UFix128) FMD ¶
func (a UFix128) FMD(b, c UFix128, round RoundingMode) (UFix128, error)
FMD returns a*b/c without intermediate rounding, or an error on division by zero, overflow, or underflow.
func (UFix128) Mod ¶
Mod returns the remainder of `a` divided by `b`, or an error on division by zero.
func (UFix128) Mul ¶
func (a UFix128) Mul(b UFix128, round RoundingMode) (UFix128, error)
Mul returns the product of `a` and `b`, or an error on overflow or underflow.
func (UFix128) Sqrt ¶
func (a UFix128) Sqrt(round RoundingMode) (UFix128, error)
Sqrt returns the square root of `a` using Newton-Rhaphson. Note that this method returns an error result for consistency with other methods, but can't actually ever fail...
type UFix64 ¶
type UFix64 raw64
Exported fixed-point types
func (UFix64) ApplySign ¶
ApplySign converts a UFix64 to a Fix64, applying the sign specified by the input.
func (UFix64) Div ¶
func (a UFix64) Div(b UFix64, round RoundingMode) (UFix64, error)
Div returns the quotient of `a` and `b`, or an error on division by zero, overflow, or underflow.
func (UFix64) FMD ¶
func (a UFix64) FMD(b, c UFix64, round RoundingMode) (UFix64, error)
FMD returns a*b/c without intermediate rounding, or an error on division by zero, overflow, or underflow.
func (UFix64) Mod ¶
Mod returns the remainder of `a` divided by `b`, or an error on division by zero.
func (UFix64) Mul ¶
func (a UFix64) Mul(b UFix64, round RoundingMode) (UFix64, error)
Mul returns the product of `a` and `b`, or an error on overflow or underflow.
func (UFix64) Sqrt ¶
func (a UFix64) Sqrt(round RoundingMode) (UFix64, error)
Sqrt returns the square root of `a` using Newton-Rhaphson. Note that this method returns an error result for consistency with other methods, but can't actually ever fail...
type UnderflowError ¶
type UnderflowError struct{}
UnderflowError is reported when the magnitude of the value is too small to be represented using the given bit length.
func (UnderflowError) Error ¶
func (UnderflowError) Error() string