2024-05-31 14:36:43 +02:00

61 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-isnumeric">Function isNumeric <a href="#function-isnumeric" title="Permalink">#</a></h1>
Test whether a value is an numeric value.
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.isNumeric(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | * | Value to be tested
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, or `boolean`. Returns false for other types. Throws an error in case of unknown types.
<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.isNumeric(2) // returns true
math.isNumeric('2') // returns false
math.hasNumericValue('2') // returns true
math.isNumeric(0) // returns true
math.isNumeric(math.bignumber('42')) // returns true
math.isNumeric(math.bigint('42')) // returns true
math.isNumeric(math.fraction(4)) // returns true
math.isNumeric(math.complex('2-4i')) // returns false
math.isNumeric([2.3, 'foo', false]) // returns [true, false, true]
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[isZero](isZero.html),
[isPositive](isPositive.html),
[isNegative](isNegative.html),
[isInteger](isInteger.html),
[hasNumericValue](hasNumericValue.html)