UNPKG

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