decimals

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: LGPL-3.0 Imports: 2 Imported by: 7

Documentation

Overview

Package decimals provides decimal formatting and conversion utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(a *big.Float) *big.Float

Abs returns the absolute value of a.

func Add

func Add(a, b *big.Float) *big.Float

Add returns a + b with 256-bit precision.

func ApplyDecimals

func ApplyDecimals(x *big.Float, y int64) (*big.Int, big.Accuracy)

ApplyDecimals multiplies x by 10^y and returns the result as a big.Int.

func Div

func Div(a, b *big.Float) *big.Float

Div returns a / b with 256-bit precision.

func FromString

func FromString(x string) (*big.Float, bool)

FromString parses x as a decimal number into a big.Float with 256-bit precision.

func Lesser

func Lesser(x, y *big.Float) bool

Lesser reports whether x is strictly less than y.

func Mul

func Mul(a, b *big.Float) *big.Float

Mul returns a * b with 256-bit precision.

func NewFloat

func NewFloat(f float64) *big.Float

NewFloat creates a big.Float from f with 256-bit precision.

func Pow

func Pow(a *big.Float, e int64) *big.Float

Pow returns a raised to the power e. Negative exponents are supported.

func RemoveDecimals

func RemoveDecimals(x *big.Int, y int64) *big.Float

RemoveDecimals divides x by 10^y and returns the result as a big.Float.

func Root

func Root(a *big.Float, n uint64) *big.Float

Root returns the n-th root of a using Newton's method with 256-bit precision.

func Sub

func Sub(a, b *big.Float) *big.Float

Sub returns a - b with 256-bit precision.

func Zero

func Zero() *big.Float

Zero returns a new big.Float zero with 256-bit precision.

Types

This section is empty.

Jump to

Keyboard shortcuts

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