Function isPositive

Test whether a value is positive: larger than zero. The function supports types number, BigNumber, Fraction, and Unit.

The function is evaluated element-wise in case of Array or Matrix input.




Parameter Type Description
x number | BigNumber | Fraction | Unit | Array | Matrix Value to be tested


Type Description
boolean Returns true when x is larger than zero. Throws an error in case of an unknown data type.


isPositive(3);                     // returns true
isPositive(-2);                    // returns false
isPositive(0);                     // returns false
isPositive(-0);                    // returns false
isPositive(0.5);                   // returns true
isPositive(bignumber(2));     // returns true
isPositive(fraction(-2, 5));  // returns false
isPositive(fraction(1,3));    // returns false
isPositive('2');                   // returns true
isPositive([2, 0, -3]');           // returns [true, false, false]

See also

isNumeric, isZero, isNegative, isInteger