type/rational - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/rational

type/rational

check for an object of type rational

type/extended_rational

check for an object of type extended_rational

 Calling Sequence type(x, rational) type(x, extended_rational)

Parameters

 x - any expression

Description

 • The type(x, rational) function returns true if x is an integer or fraction.  Otherwise, it returns false.
 • The type(x, extended_rational) function returns true if x is a rational, infinity, -infinity, or undefined. Equivalently, x is of type extended_rational if it is of type extended_numeric and not of type float.

Examples

 > $\mathrm{type}\left(1,\mathrm{rational}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(\frac{1}{2},\mathrm{rational}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(0.5,\mathrm{rational}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left(\mathrm{Name},\mathrm{rational}\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{type}\left(\frac{a}{b},\mathrm{rational}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{type}\left(\mathrm{∞},\mathrm{extended_rational}\right)$
 ${\mathrm{true}}$ (6)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam