Documentation ¶
Index ¶
- func RationalsAreNull(l []Rational) (isNull bool)
- type Rational
- func (ev Rational) Add(e Rational) (nv Rational)
- func (ev Rational) AddNum(i int64) Rational
- func (ev Rational) Divide(e Rational) (nv Rational)
- func (ev Rational) DivideByNum(i int64) Rational
- func (ev Rational) Float64() float64
- func (ev Rational) Get() (numerator, denominator int64)
- func (ev Rational) GetDenominator() int64
- func (ev Rational) GetModule() Rational
- func (ev Rational) GetNumerator() int64
- func (ev Rational) GreaterThan(e Rational) bool
- func (ev Rational) GreaterThanNum(i int64) bool
- func (ev Rational) IsNatural() bool
- func (ev Rational) IsNull() (n bool)
- func (ev Rational) LessThan(e Rational) bool
- func (ev Rational) LessThanNum(i int64) bool
- func (ev Rational) Multiply(e Rational) (nv Rational)
- func (ev Rational) MultiplyByNum(i int64) Rational
- func (ev *Rational) Simplify()
- func (ev Rational) Subtract(e Rational) (nv Rational)
- func (ev Rational) SubtractNum(i int64) Rational
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RationalsAreNull ¶
RationalsAreNull determines whether the slice of Rationals contains only zero values.
Types ¶
type Rational ¶
type Rational struct {
// contains filtered or unexported fields
}
Rational stores a rational value.
func NewFromFloat ¶
NewFromFloat returns new rational number representation retrieved from float64.
func (Rational) DivideByNum ¶
DivideByNum divides a rational value by the provided integer.
func (Rational) GetDenominator ¶
GetDenominator returns a denominator.
func (Rational) GetNumerator ¶
GetNumerator returns a numerator.
func (Rational) GreaterThan ¶
GreaterThan returns true if a rational is greater than the passed one.
func (Rational) GreaterThanNum ¶
GreaterThanNum returns true if a rational is greater than the passed integer.
func (Rational) LessThanNum ¶
LessThanNum returns true if a rational is less than the passed integer.
func (Rational) MultiplyByNum ¶
MultiplyByNum multiplies a rational value by the provided integer.
func (*Rational) Simplify ¶
func (ev *Rational) Simplify()
Simplify simplifies the rational number by dividing it's numerator and denominator by the GCD.
func (Rational) SubtractNum ¶
SubtractNum subtracts the provided integer from an existing rational number.