rational

package
v0.0.0-...-5960636 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const MaxIterations = 5000

MaxIterations is some sane limit of iterations for precision mode

Variables

This section is empty.

Functions

This section is empty.

Types

type Rational

type Rational big.Rat

func New

func New(val float64, iterations int64, stepPrecision float64) Rational

func NewFromBigIntComponents

func NewFromBigIntComponents(num, den *big.Int) Rational

func NewFromComponents

func NewFromComponents(num, den int64) Rational

func NewWithDecimalPlaces

func NewWithDecimalPlaces(val float64, dp int) Rational

func NewWithIterations

func NewWithIterations(val float64, iterations int64) Rational

NewWithIterations returns rational from decimal using `iterations` number of iterations in Continued Fraction algorithm

func NewWithPrecision

func NewWithPrecision(val float64, stepPrecision float64) Rational

NewWithPrecision returns rational from decimal by going as mush iterations, until next fraction is less than `stepPrecision`

func (Rational) Compare

func (r Rational) Compare(r2 Rational) int

func (Rational) Denominator

func (r Rational) Denominator() *big.Int

func (Rational) DenominatorInt64

func (r Rational) DenominatorInt64() int64

func (Rational) Equals

func (r Rational) Equals(r2 Rational) bool

func (Rational) Numerator

func (r Rational) Numerator() *big.Int

func (Rational) NumeratorInt64

func (r Rational) NumeratorInt64() int64

func (Rational) String

func (r Rational) String() string

Jump to

Keyboard shortcuts

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