Fractions and the Fraction Constructor
Calling Sequence
Parameters
Description
Fraction(x, y)
x
-
expression
y
(optional) expression
A fraction is represented by the form signed_integer / natural_number with all common factors removed. Like integers, fractions can be of arbitrary length.
The Fraction(x, y) constructor function returns the following types of objects for the indicated values of x and y.
x if x is already a rational and y is not included in the calling sequence; Fraction(x) returns Fraction(x,1) otherwise.
rational if x and y are integers and y <> 0, representing x/y. If, after reduction to lowest terms, the denominator of this rational is 1, then the result is replaced by the corresponding integer.
Fraction(x1*y2, x2*y1), if either of x or y is a rational, where x1 = numer(Fraction(x)), x2 = denom(Fraction(x)), y1 = numer(Fraction(y)), and y2 = denom(Fraction(y)).
infinity if x = infinity (symbolic) and y > 0 is an integer, or if x = -infinity (symbolic) and y < 0 is an integer, or if x > 0 is an integer and y = 0 (exact). If y = 0, this signals Divide by 0.
-infinity if x = -infinity (symbolic) and y > 0 is an integer, or if x = infinity (symbolic) and y < 0 is an integer, or if x < 0 is an integer and y = 0 (exact). If y = 0, this signals Divide by 0.
Returns the symbol undefined if x and y are both exact integer 0's or are both symbolic infinities.
x if x is a symbolic undefined (y can be anything).
y if y is a symbolic undefined and x is not.
0 if x is finite and y is infinite.
Fraction(Re(x), y) + I * Fraction(Im(x), y) if x is of type nonreal.
unevaluated otherwise.
The numerator and denominator of a rational number are obtained by using the numer and denom routines, respectively.
See Also
convert
float
integer
op
type
type/fraction
type/rational
Download Help Document