type/integer - Maple Programming Help

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

type/integer

check for an object of type integer

 Calling Sequence type(x, integer) type(x, integer[n]) type(x, integer[a..b])

Parameters

 x - any expression n - 1, 2, 4, or 8 a, b - integers with $a\le b$

Description

 • The type(x, integer) function returns true if x is a Maple integer.
 • If the type is provided with a single integer index n, then type(expr, integer[n]) returns true if, and only if, $n$ is one of $1$, $2$, $4$, or $8$, and expr is an integer representable as a signed $n$-byte hardware integer.
 • The call type(expr, integer[a .. b ]) returns true if, and only if, expr is an integer satisfying the inequalities $a\le \mathrm{expr}$ and $\mathrm{expr}\le b$, where a and b are integers with $a\le b$.

Examples

 > $\mathrm{type}\left(1,\mathrm{integer}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(\frac{1}{2},\mathrm{integer}\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{type}\left(0.5,\mathrm{integer}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left("String",\mathrm{integer}\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{type}\left(\mathrm{Name},\mathrm{integer}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{type}\left({a}_{b},\mathrm{integer}\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{type}\left(\frac{a}{b},\mathrm{integer}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(200,\mathrm{integer}[1]\right)$
 ${\mathrm{false}}$ (8)
 > $\mathrm{type}\left(300,\mathrm{integer}[1]\right)$
 ${\mathrm{false}}$ (9)
 > $\mathrm{type}\left(300,\mathrm{integer}[2]\right)$
 ${\mathrm{true}}$ (10)
 > $\mathrm{type}\left(5,\mathrm{integer}[1..10]\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{type}\left(5,\mathrm{integer}[6..10]\right)$
 ${\mathrm{false}}$ (12)
 > $\mathrm{type}\left(5.0,\mathrm{integer}[1..10]\right)$
 ${\mathrm{false}}$ (13)
 > $\mathrm{map}\left(\mathrm{type},\left[-129,-128,127,128\right],\mathrm{integer}[1]\right)$
 $\left[{\mathrm{false}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{false}}\right]$ (14)