Show:
Defined in: src/fraction.js:19

Initialize the Fraction, numerator and denominator

Constructor

Fraction

(
  • numerator
  • denominator
)

Defined in src/fraction.js:19

Parameters:

  • numerator Integer

    of the fraction

  • denominator Integer

    the fraction must not be equal to 0

Item Index

Properties

Methods

add

() Fraction

Defined in src/fraction.js:118

Adds the value of this fraction to another, returning the result in reduced form.

Returns:

clone

() Fraction

Defined in src/fraction.js:52

clone the Fraction

Returns:

Fraction:

Returns a clone of the fraction

compareTo

() Fraction

Defined in src/fraction.js:184

Compares this object to another based on size.

Returns:

gcf

() Number static

Defined in src/fraction.js:219

Takes two numbers and returns their greatest common factor

Returns:

Number:

inverse

() Fraction

Defined in src/fraction.js:62

inverse the Fraction

Returns:

Fraction:

Returns the inverse of the fraction

parse

() Fraction static

Defined in src/fraction.js:240

parse a string of the format a/b to a Fraction

Returns:

subtract

() Fraction

Defined in src/fraction.js:135

Subtracts the value of another fraction from the value of this one, returning the result in reduced form

Returns:

toString

() String

Defined in src/fraction.js:71

pretty-printer, converts fractions into whole numbers and fractions

Returns:

String:

toTeX

() String

Defined in src/fraction.js:82

pretty-printer to support TeX notation (using with MathJax, KaTeX, etc)

Returns:

String:

value

() Number

Defined in src/fraction.js:43

Returns:

Number:

the float number represented by the fraction

Properties

ONE

Fraction final static

Defined in src/fraction.js:272

Fraction representation of 1.

ZERO

Fraction final static

Defined in src/fraction.js:264

Fraction representation of 0.