Documentation ¶
Index ¶
- Variables
- type Context64
- type Decimal64
- func (d Decimal64) Abs() Decimal64
- func (d Decimal64) Add(e Decimal64) Decimal64
- func (d Decimal64) Append(buf []byte, format byte, prec int) []byte
- func (d Decimal64) Class() string
- func (d Decimal64) Cmp(e Decimal64) int
- func (d Decimal64) FMA(e, f Decimal64) Decimal64
- func (d Decimal64) Float64() float64
- func (d Decimal64) Format(s fmt.State, format rune)
- func (d *Decimal64) GobDecode(buf []byte) error
- func (d Decimal64) GobEncode() ([]byte, error)
- func (d Decimal64) Int64() int64
- func (d Decimal64) IsInf() bool
- func (d Decimal64) IsInt() bool
- func (d Decimal64) IsNaN() bool
- func (d Decimal64) IsQNaN() bool
- func (d Decimal64) IsSNaN() bool
- func (d Decimal64) IsSubnormal() bool
- func (d Decimal64) IsZero() bool
- func (d Decimal64) MarshalJSON() ([]byte, error)
- func (d Decimal64) MarshalText() []byte
- func (d Decimal64) Mul(e Decimal64) Decimal64
- func (d Decimal64) Neg() Decimal64
- func (d Decimal64) Quo(e Decimal64) Decimal64
- func (d *Decimal64) Scan(state fmt.ScanState, verb rune) error
- func (d Decimal64) Sign() int
- func (d Decimal64) Signbit() bool
- func (d Decimal64) Sqrt() Decimal64
- func (d Decimal64) String() string
- func (d Decimal64) Sub(e Decimal64) Decimal64
- func (d Decimal64) Text(format byte, prec int) string
- func (d *Decimal64) UnmarshalJSON(data []byte) error
- func (d *Decimal64) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
var DefaultContext = Context64{roundHalfUp}
DefaultContext is the context that Arithmetic functions will use in order to do calculations
var E64 = newFromParts(0, -15, 2718281828459045)
E64 represents e (lim[n→∞](1+1/n)ⁿ).
var Infinity64 = Decimal64{inf64}
Infinity64 represents ∞ as a Decimal64.
var Max64 = newFromParts(0, expMax, maxSig)
Max64 is the maximum number representable with a Decimal64.
var Min64 = newFromParts(0, -398, 1)
Min64 is the smallest number that is subnormal possible with Decimal64.
var NegInfinity64 = Decimal64{neg64 | inf64}
NegInfinity64 represents -∞ as a Decimal64.
var NegMax64 = newFromParts(1, expMax, maxSig)
NegMax64 is the minimum finite number (most negative) possible with Decimal64 (negative).
var NegOne64 = newFromParts(1, -15, decimal64Base)
NegOne64 represents -1 as a Decimal64.
var NegZero64 = newFromParts(1, 0, 0)
NegZero64 represents -0 as a Decimal64.
var One64 = newFromParts(0, -15, decimal64Base)
One64 represents 1 as a Decimal64.
var Pi64 = newFromParts(0, -15, 3141592653589793)
Pi64 represents π.
var QNaN64 = Decimal64{0x7c << 56}
QNaN64 represents a quiet NaN as a Decimal64.
var SNaN64 = Decimal64{0x7e << 56}
SNaN64 represents a signalling NaN as a Decimal64.
var Zero64 = newFromParts(0, 0, 0)
Zero64 represents 0 as a Decimal64.
Functions ¶
This section is empty.
Types ¶
type Context64 ¶
type Context64 struct {
// contains filtered or unexported fields
}
Context64 stores the rounding type for arithmetic operations.
type Decimal64 ¶
type Decimal64 struct {
// contains filtered or unexported fields
}
Decimal64 represents an IEEE 754 64-bit floating point decimal number. It uses the binary representation method. Decimal64 is intentionally a struct to ensure users don't accidentally cast it to uint64
func MustParse64 ¶
MustParse64 parses a string as a Decimal64 and returns the value or panics if the string doesn't represent a valid Decimal64.
func New64FromInt64 ¶
New64FromInt64 returns a new Decimal64 with the given value.
func (Decimal64) Cmp ¶
Cmp returns:
-2 if d or e is NaN -1 if d < e 0 if d == e (incl. -0 == 0, -Inf == -Inf, and +Inf == +Inf) +1 if d > e
func (Decimal64) IsSubnormal ¶
IsSubnormal returns true iff d is a subnormal.
func (Decimal64) MarshalJSON ¶
MarshalText implements the encoding.TextMarshaler interface.
func (Decimal64) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (Decimal64) Text ¶
Text converts the floating-point number x to a string according to the given format and precision prec.
func (*Decimal64) UnmarshalJSON ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Decimal64) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.