Documentation ¶
Index ¶
- func ToFloat64(n Number) float64
- func ToInt64(n Number) int64
- type Any
- type Float64Traits
- func (Float64Traits) AddAtomic(ptr *float64, value float64)
- func (Float64Traits) FromNumber(n Number) float64
- func (Float64Traits) GetAtomic(ptr *float64) float64
- func (Float64Traits) IsInf(value float64) bool
- func (Float64Traits) IsNaN(value float64) bool
- func (Float64Traits) Kind() Kind
- func (Float64Traits) SetAtomic(ptr *float64, value float64)
- func (Float64Traits) SwapAtomic(ptr *float64, value float64) float64
- func (Float64Traits) ToNumber(x float64) Number
- type Int64Traits
- func (Int64Traits) AddAtomic(ptr *int64, value int64)
- func (Int64Traits) FromNumber(n Number) int64
- func (Int64Traits) GetAtomic(ptr *int64) int64
- func (Int64Traits) IsInf(_ int64) bool
- func (Int64Traits) IsNaN(_ int64) bool
- func (Int64Traits) Kind() Kind
- func (Int64Traits) SetAtomic(ptr *int64, value int64)
- func (Int64Traits) SwapAtomic(ptr *int64, value int64) int64
- func (Int64Traits) ToNumber(x int64) Number
- type Kind
- type Number
- type Traits
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Float64Traits ¶
type Float64Traits struct{}
Float64Traits implements Traits[float64].
func (Float64Traits) AddAtomic ¶
func (Float64Traits) AddAtomic(ptr *float64, value float64)
func (Float64Traits) FromNumber ¶
func (Float64Traits) FromNumber(n Number) float64
func (Float64Traits) GetAtomic ¶
func (Float64Traits) GetAtomic(ptr *float64) float64
func (Float64Traits) IsInf ¶
func (Float64Traits) IsInf(value float64) bool
func (Float64Traits) IsNaN ¶
func (Float64Traits) IsNaN(value float64) bool
func (Float64Traits) Kind ¶
func (Float64Traits) Kind() Kind
func (Float64Traits) SetAtomic ¶
func (Float64Traits) SetAtomic(ptr *float64, value float64)
func (Float64Traits) SwapAtomic ¶
func (Float64Traits) SwapAtomic(ptr *float64, value float64) float64
func (Float64Traits) ToNumber ¶
func (Float64Traits) ToNumber(x float64) Number
type Int64Traits ¶
type Int64Traits struct{}
Int64Traits implements Traits[int64].
func (Int64Traits) AddAtomic ¶
func (Int64Traits) AddAtomic(ptr *int64, value int64)
func (Int64Traits) FromNumber ¶
func (Int64Traits) FromNumber(n Number) int64
func (Int64Traits) GetAtomic ¶
func (Int64Traits) GetAtomic(ptr *int64) int64
func (Int64Traits) IsInf ¶
func (Int64Traits) IsInf(_ int64) bool
func (Int64Traits) IsNaN ¶
func (Int64Traits) IsNaN(_ int64) bool
func (Int64Traits) Kind ¶
func (Int64Traits) Kind() Kind
func (Int64Traits) SetAtomic ¶
func (Int64Traits) SetAtomic(ptr *int64, value int64)
func (Int64Traits) SwapAtomic ¶
func (Int64Traits) SwapAtomic(ptr *int64, value int64) int64
func (Int64Traits) ToNumber ¶
func (Int64Traits) ToNumber(x int64) Number
type Number ¶
type Number uint64
Number is a 64bit numeric value, one of the Any interface types.
func (Number) CoerceToFloat64 ¶
CoerceToFloat64 converts Number to float64 according to Kind.
type Traits ¶
type Traits[N Any] interface { // FromNumber turns a generic 64bits into the correct machine type. FromNumber(Number) N // ToNumber turns this type into a generic 64bit value. ToNumber(value N) Number // SetAtomic sets `ptr` to `value`. SetAtomic(ptr *N, value N) // GetAtomic reads `ptr`. GetAtomic(ptr *N) N // AddAtomic sets `ptr` to `value+*ptr`. AddAtomic(ptr *N, value N) // SwapAtomic sets `ptr` to `value` and returns the former value. SwapAtomic(ptr *N, value N) N // IsNaN indicates whether `math.IsNaN()` is true (impossible for int64). IsNaN(value N) bool // IsInf indicates whether `math.IsInf()` is true (impossible for int64). IsInf(value N) bool // Kind returns the number kind of these Traits. Kind() Kind }
Traits is the generic traits interface for numbers used in the SDK.
Click to show internal directories.
Click to hide internal directories.