Fraction Class
Defined in:
src/fraction.js:19
Initialize the Fraction, numerator and denominator
Constructor
Fraction
(
-
numerator
-
denominator
Parameters:
-
numerator
Integerof the fraction
-
denominator
Integerthe fraction must not be equal to 0
Item Index
Methods
add
()
Fraction
Adds the value of this fraction to another, returning the result in reduced form.
Returns:
gcf
()
Number
static
Takes two numbers and returns their greatest common factor
Returns:
Number:
subtract
()
Fraction
Subtracts the value of another fraction from the value of this one, returning the result in reduced form
Returns:
toString
()
String
pretty-printer, converts fractions into whole numbers and fractions
Returns:
String:
toTeX
()
String
pretty-printer to support TeX notation (using with MathJax, KaTeX, etc)
Returns:
String:
value
()
Number
Returns:
Number:
the float number represented by the fraction