fraction

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component[T constraints.Float](n T) int

func IsZero added in v1.0.33

func IsZero(elem Fraction) bool

func Magnitude

func Magnitude[T constraints.Float](n T) int

Types

type Fraction

type Fraction struct {
	Numerator   int
	Denominator int
}

func FromFloat

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

func New

func New(numerator, denominator int) Fraction

func (Fraction) Copy

func (t Fraction) Copy() Fraction

func (Fraction) Float

func (t Fraction) Float() float64

func (Fraction) IsZero added in v1.0.33

func (t Fraction) IsZero() bool

func (Fraction) Reduce

func (t Fraction) Reduce() Fraction

func (Fraction) String added in v1.0.33

func (t Fraction) String() string

Jump to

Keyboard shortcuts

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