osmomath

package
v8.0.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsDifferenceWithSign

func AbsDifferenceWithSign(a, b sdk.Dec) (sdk.Dec, bool)

AbsDifferenceWithSign returns | a - b |, (a - b).sign() a is mutated and returned

func Pow

func Pow(base sdk.Dec, exp sdk.Dec) sdk.Dec

Pow computes base^(exp) However since the exponent is not an integer, we must do an approximation algorithm. TODO: In the future, lets add some optimized routines for common exponents, e.g. for common wIn / wOut ratios Many simple exponents like 2:1 pools

func PowApprox

func PowApprox(base sdk.Dec, exp sdk.Dec, precision sdk.Dec) sdk.Dec

Contract: 0 < base <= 2 0 < exp < 1

Types

This section is empty.

Jump to

Keyboard shortcuts

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