Documentation
¶
Overview ¶
Package jsnum provides JS-like number handling.
Index ¶
- type Number
- func (x Number) Abs() Number
- func (x Number) BitwiseAND(y Number) Number
- func (x Number) BitwiseNOT() Number
- func (x Number) BitwiseOR(y Number) Number
- func (x Number) BitwiseXOR(y Number) Number
- func (base Number) Exponentiate(exponent Number) Number
- func (x Number) Floor() Number
- func (n Number) IsInf() bool
- func (n Number) IsNaN() bool
- func (x Number) LeftShift(y Number) Number
- func (n Number) Remainder(d Number) Number
- func (x Number) SignedRightShift(y Number) Number
- func (n Number) String() string
- func (x Number) UnsignedRightShift(y Number) Number
- type PseudoBigInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Number ¶
type Number float64
Number represents a JS-like number.
All operations that can be performed directly on this type (e.g., conversion, arithmetic, etc.) behave as they would in JavaScript, but any other operation should use this type's methods, not the "math" package and conversions.
const ( MaxSafeInteger Number = 1<<53 - 1 MinSafeInteger Number = -MaxSafeInteger )
func FromString ¶
https://tc39.es/ecma262/2024/multipage/abstract-operations.html#sec-stringtonumber
func (Number) BitwiseAND ¶
func (Number) BitwiseNOT ¶
func (Number) BitwiseXOR ¶
func (Number) Exponentiate ¶
func (Number) SignedRightShift ¶
func (Number) UnsignedRightShift ¶
type PseudoBigInt ¶
PseudoBigInt represents a JS-like bigint.
func (PseudoBigInt) Sign ¶
func (value PseudoBigInt) Sign() int
func (PseudoBigInt) String ¶
func (value PseudoBigInt) String() string
Click to show internal directories.
Click to hide internal directories.