Function isZero

Test whether a value is zero. The function can check for zero for types number, BigNumber, Fraction, Complex, and Unit.

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




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


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


isZero(0);                     // returns true
isZero(2);                     // returns false
isZero(0.5);                   // returns false
isZero(bignumber(0));     // returns true
isZero(fraction(0));      // returns true
isZero(fraction(1,3));    // returns false
isZero(complex('2 - 4i'); // returns false
isZero(complex('0i');     // returns true
isZero('0');                   // returns true
isZero('2');                   // returns false
isZero([2, 0, -3]');           // returns [false, true, false]

See also

isNumeric, isPositive, isNegative, isInteger