--- layout: default ---

Function isInteger #

Test whether a value is an integer number. The function supports `number`, `BigNumber`, and `Fraction`. The function is evaluated element-wise in case of Array or Matrix input.

Syntax #

```js math.isInteger(x) ```

Parameters #

Parameter | Type | Description --------- | ---- | ----------- `x` | number | BigNumber | Fraction | Array | Matrix | Value to be tested

Returns #

Type | Description ---- | ----------- boolean | Returns true when `x` contains a numeric, integer value. Throws an error in case of an unknown data type.

Throws #

Type | Description ---- | -----------

Examples #

```js math.isInteger(2) // returns true math.isInteger(0) // returns true math.isInteger(0.5) // returns false math.isInteger(math.bignumber(500)) // returns true math.isInteger(math.fraction(4)) // returns true math.isInteger('3') // returns true math.isInteger([3, 0.5, -2]) // returns [true, false, true] math.isInteger(math.complex('2-4i')) // throws an error ```

See also #

[isNumeric](isNumeric.html), [isPositive](isPositive.html), [isNegative](isNegative.html), [isZero](isZero.html)