fraction

package
v0.0.0-...-94f88f4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GCD

func GCD(a, b int) int

Types

type Fraction

type Fraction struct {
	Numerator   int
	Denominator int
}

func FromInt

func FromInt(numerator int) Fraction

func Make

func Make(numerator int, denominator int) Fraction

func Zero

func Zero() Fraction

func (Fraction) Add

func (fraction Fraction) Add(other Fraction) Fraction

func (Fraction) Divide

func (fraction Fraction) Divide(other Fraction) Fraction

func (Fraction) Equals

func (fraction Fraction) Equals(other Fraction) bool

func (Fraction) GreaterThan

func (fraction Fraction) GreaterThan(other Fraction) bool

func (Fraction) Invert

func (fraction Fraction) Invert() Fraction

func (Fraction) IsZero

func (fraction Fraction) IsZero() bool

func (Fraction) LessThan

func (fraction Fraction) LessThan(other Fraction) bool

func (Fraction) LessThanEqual

func (fraction Fraction) LessThanEqual(other Fraction) bool

func (Fraction) Multiply

func (fraction Fraction) Multiply(other Fraction) Fraction

func (Fraction) Negate

func (fraction Fraction) Negate() Fraction

func (Fraction) NormalString

func (fraction Fraction) NormalString() string

convert 3/2 into '1 1/2' 1/2 -> '1/2'

func (Fraction) Reduce

func (fraction Fraction) Reduce() Fraction

func (Fraction) String

func (fraction Fraction) String() string

func (Fraction) Subtract

func (fraction Fraction) Subtract(other Fraction) Fraction

func (Fraction) ToFloat

func (fraction Fraction) ToFloat() float64

Jump to

Keyboard shortcuts

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