rational

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 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(elem 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() bool

func (Rational) Mixed

func (t Rational) Mixed() Rational

func (Rational) Reduce

func (t Rational) Reduce() Rational

func (Rational) String added in v1.0.33

func (t Rational) String() string

Jump to

Keyboard shortcuts

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