Frac
import { Frac } from "https://raw.githubusercontent.com/JOTSR/Denum/master/mod.ts";§Constructors
The constructor function takes two arguments, num and den, and sets the numerator and
denominator of the rational number to the absolute value of num and den, respectively, and
the sign of the numerator to the sign of Frac
- The numerator of the rational number.
- The denominator of the rational number.
§Properties
§Methods
isEven returns true if the fraction is even, false otherwise
A boolean value.
If the simplified denominator is 1, then the fraction is an integer.
a boolean value.
Returns true if the current fraction is lesser than the compared fraction, or if the compared fraction is equal to the current fraction and the ifEqual parameter is true.
- The fraction to compare to.
The return value is a boolean.
It returns true if the number is 0n, and false otherwise
a boolean value.
It takes a bigint as an argument and returns a new Frac object with the numerator and denominator raised to the power of the argument
- The power to raise the fraction to.
A new Frac object with the numerator and denominator raised to the power of the input.
If the number is less than zero, return negative one, otherwise return positive one.
The sign of the number.
If the numerator and denominator are within the range of a 32 bit float, and the denominator is not zero, return the float value of the numerator divided by the denominator
- Number of significant decimals (0-16)
A function that returns a float.
The function returns a string that is a JSON representation of the object
A string representation of the object.
If the numerator is negative, return the fraction wrapped in parentheses. Otherwise, return the fraction as a LaTeX string
A string.
It returns a evaluable string representation of the fraction.
The numerator and denominator of the fraction.