API Docs for: 0.9.3
Show:

Rational Class

Extends Field
Module: blade

The Rational class represents a rational number.

Constructor

Rational

(
  • n
  • d
)

Parameters:

  • n Number

    The numerator.

  • d Number

    The denominator.

Item Index

Methods

Properties

Methods

add

(
  • rhs
)
Rational

Returns the sum of this rational number and the argument.

Parameters:

  • rhs Number | Rational

    The number used on the right hand side of the addition operator.

Returns:

Rational:

The sum of this rational number and the specified argument.

sub

(
  • rhs
)
Rational

Returns the difference of this rational number and the argument.

Parameters:

  • rhs Number | Rational

    The number used on the right hand side of the subtraction operator.

Returns:

Rational:

The difference of this rational number and the specified argument.

Properties

denom

Number

The denominator part of the rational number.

numer

Number

The numerator part of the rational number.