Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Expressions > Testing Expressions > IntegerQ >
Mathematica > Core Language > Procedural Programming > Conditionals > Testing Expressions > IntegerQ >

IntegerQ

IntegerQ[expr]
gives True if expr is an integer, and False otherwise.
  • Simplify[exprIntegers] can be used to try to determine whether an expression is mathematically equal to an integer.
IntegerQ tests whether an expression is explicitly an integer:
IntegerQ tests whether an expression is explicitly an integer:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Test whether an array consists of all integers:
Make a test for Gaussian integers:
Integers have head Integer:
An expression may have head Integer, but IntegerQ gives False:
Expressions that do not evaluate to integers explicitly will still give False:
It is necessary to use symbolic simplification first:
New in 1 | Last modified in 4
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF