jsnum

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package jsnum provides JS-like number handling.

Index

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 Inf

func Inf(sign int) Number

func NaN

func NaN() Number

func (Number) Abs

func (x Number) Abs() Number

func (Number) Floor

func (x Number) Floor() Number

func (Number) IsInf

func (n Number) IsInf() bool

func (Number) IsNaN

func (n Number) IsNaN() bool

type PseudoBigInt

type PseudoBigInt struct {
	Negative    bool
	Base10Value string
}

PseudoBigInt represents a JS-like bigint.

func (PseudoBigInt) Sign

func (value PseudoBigInt) Sign() int

func (PseudoBigInt) String

func (value PseudoBigInt) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL