fixedpoint

package
v0.42.9 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

Package fixedpoint provides constants, as well as formatting, conversion, and checking functionality for Cadence fixed-point number types

Index

Constants

View Source
const Fix64Factor = 100_000_000
View Source
const Fix64Scale = 8
View Source
const Fix64TypeMaxFractional = math.MaxInt64 % Fix64Factor
View Source
const Fix64TypeMaxInt = math.MaxInt64 / Fix64Factor
View Source
const Fix64TypeMinFractional = math.MinInt64 % Fix64Factor
View Source
const Fix64TypeMinInt = math.MinInt64 / Fix64Factor
View Source
const UFix64TypeMaxFractional = math.MaxUint64 % uint64(Fix64Factor)
View Source
const UFix64TypeMaxInt = math.MaxUint64 / uint64(Fix64Factor)
View Source
const UFix64TypeMinFractional = 0
View Source
const UFix64TypeMinInt = 0

Variables

View Source
var Fix64TypeMaxFractionalBig = new(big.Int).SetInt64(Fix64TypeMaxFractional)
View Source
var Fix64TypeMaxIntBig = new(big.Int).SetInt64(Fix64TypeMaxInt)
View Source
var Fix64TypeMinFractionalBig = new(big.Int).SetInt64(Fix64TypeMinFractional)
View Source
var Fix64TypeMinIntBig = new(big.Int).SetInt64(Fix64TypeMinInt)
View Source
var UFix64TypeMaxFractionalBig = new(big.Int).SetUint64(UFix64TypeMaxFractional)
View Source
var UFix64TypeMaxIntBig = new(big.Int).SetUint64(UFix64TypeMaxInt)
View Source
var UFix64TypeMinFractionalBig = new(big.Int).SetUint64(UFix64TypeMinFractional)
View Source
var UFix64TypeMinIntBig = new(big.Int).SetUint64(UFix64TypeMinInt)

Functions

func CheckRange

func CheckRange(
	negative bool,
	unsignedIntegerValue, fractionalValue,
	minInt, minFractional,
	maxInt, maxFractional *big.Int,
) bool

func ConvertToFixedPointBigInt

func ConvertToFixedPointBigInt(
	negative bool,
	unsignedInteger *big.Int,
	fractional *big.Int,
	scale uint,
	targetScale uint,
) *big.Int

func NewFix64

func NewFix64(
	negative bool,
	unsignedInteger *big.Int,
	fractional *big.Int,
	parsedScale uint,
) (
	*big.Int,
	error,
)

func NewUFix64

func NewUFix64(
	unsignedInteger *big.Int,
	fractional *big.Int,
	parsedScale uint,
) (
	*big.Int,
	error,
)

func ParseFix64

func ParseFix64(s string) (*big.Int, error)

func ParseUFix64

func ParseUFix64(s string) (*big.Int, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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