simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

isZero.md (1514B)


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