rational

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fraction

func Fraction[T constraints.Float](x T) fraction.Fraction

func FractionComponent

func FractionComponent[T constraints.Float](x T) int

func IsZero

func IsZero(item Rational) bool

func Whole

func Whole[T constraints.Float](x T) int

Types

type Rational

type Rational struct {
	Whole    int
	Fraction fraction.Fraction
}

func FromFloat

func FromFloat[T constraints.Float](n T) Rational

func FromString

func FromString[T ~string](s T) (Rational, error)

func MustString

func MustString[T ~string](s T) Rational

func New

func New(whole, numerator, denominator int) Rational

func (Rational) Copy

func (t Rational) Copy() Rational

func (Rational) Float

func (t Rational) Float() float64

func (Rational) Improper

func (t Rational) Improper() Rational

func (Rational) IsZero

func (t Rational) IsZero(item Rational) bool

func (Rational) Mixed

func (t Rational) Mixed() Rational

func (Rational) Reduce

func (t Rational) Reduce() Rational

Jump to

Keyboard shortcuts

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