Number

package
v0.0.0-...-7429549 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	ToGoInt() int64
	ToGoFloat() float64
	ToGoString() string
	IsInt() bool
	IsFloat() bool
	IsNull() bool
	Add(Interface) Result.Interface
	Sub(Interface) Result.Interface
	Mul(Interface) Result.Interface
	Div(Interface) Result.Interface
	Mod(Interface) Result.Interface
	Abs() Result.Interface
	Neg() Result.Interface
	Equal(Interface) Boolean.Interface
	LessThan(Interface) Boolean.Interface
	GreaterThan(Interface) Boolean.Interface
	Inspect() String
}

Number is a numeric composite over a Go int64 or float64 value.

Its fallible operations (notably Div) return a Result.Interface so that failures — such as a division by zero — are values rather than panics.

func New

func New(options ...Option) Interface

type Option

type Option func(*data)

func WithFloat

func WithFloat(value float64) Option

WithFloat is a functional parameter setting the Number value from a Go float64.

The resulting Number reports IsFloat() == true.

func WithInt

func WithInt(value int64) Option

WithInt is a functional parameter setting the Number value from a Go int64.

The resulting Number reports IsInt() == true.

type String

type String = string

String is the lightweight inspection representation of a Number.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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