2022-07-25 10:14:12 +02:00

60 lines
1.8 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-isinteger">Function isInteger <a href="#function-isinteger" title="Permalink">#</a></h1>
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.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.isInteger(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; Fraction &#124; Array &#124; Matrix | Value to be tested
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
boolean | Returns true when `x` contains a numeric, integer value. Throws an error in case of an unknown data type.
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```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
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[isNumeric](isNumeric.html),
[isPositive](isPositive.html),
[isNegative](isNegative.html),
[isZero](isZero.html)