UNPKG

1.26 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function isNumeric
4
5Test whether a value is an numeric value.
6
7The function is evaluated element-wise in case of Array or Matrix input.
8
9
10## Syntax
11
12```js
13math.isNumeric(x)
14```
15
16### Parameters
17
18Parameter | Type | Description
19--------- | ---- | -----------
20`x` | * | Value to be tested
21
22### Returns
23
24Type | Description
25---- | -----------
26boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, or `boolean`. Returns false for other types. Throws an error in case of unknown types.
27
28
29## Examples
30
31```js
32math.isNumeric(2) // returns true
33math.isNumeric('2') // returns false
34math.hasNumericValue('2') // returns true
35math.isNumeric(0) // returns true
36math.isNumeric(math.bignumber(500)) // returns true
37math.isNumeric(math.fraction(4)) // returns true
38math.isNumeric(math.complex('2-4i') // returns false
39math.isNumeric([2.3, 'foo', false]) // returns [true, false, true]
40```
41
42
43## See also
44
45[isZero](isZero.md),
46[isPositive](isPositive.md),
47[isNegative](isNegative.md),
48[isInteger](isInteger.md),
49[hasNumericValue](hasNumericValue.md)