UNPKG

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