rational

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 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 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 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) 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