# Boolean Operators

## Infix Operators

### Equality `==` :

Description: This operator tests whether two expressions evaluate to the same value. The result of this operator is either `true` or `false`.

### Not equal `!=` :

Description: This operator tests whether two expressions do not evaluate to the same value. The result of this operator is either `true` or `false`. It is the logical negation of `==` .

### Greater than `>` :

Description: This operator tests whether the expression `` is greater than the expression ``. It returns a `` value. The comparison is available only for two situations: If both expressions are real numbers, then the order of size is the usual ordering of real numbers. If both expressions are strings, then the order is the lexicographic (dictionary) order. In all other cases (if the values are not comparable) the value `_?_` is returned.

### Less than `<` :

Description: This operator is similar to > but tests for less than.

### Greater than or equal `>=` :

Description: This operator is similar to > but tests for greater than or equal to.

### Less than or equal `<=` :

Description: This operator is similar to > but tests for less than or equal to.

### Fuzzy comparisons `~==`, `~!=`, `~<`, `~>`, `~>=`, `~<=` :

Description: CindyScript provides a fuzzy variant for each comparison operator. This Version tests whether the condition is satisfied up to an epsilon bound. Thus the test `a~==0` tests whether is the variable `a` lies between `+epsilon` and `-epsilon`. The small value epsison is set to `0.0000000001`. THis operator is sometimes very useful to circumvent inaccuracies which are unavoidable in purely numerical calculations.
The exact semantics of the exact and the fuzzy operators can be read off from the following diagram. Here for each operator the picture shows for which region of `b` (marked in red) the operator evaluates to true.

### Logical and `&` :

Description: Logical and of two Boolean values defined by the following truth table:

`A` | `B` | `A & B`
`false` | `false` | `false`
`false` | `true` | `false`
`true` | `false` | `false`
`true` | `true` | `true`

If one of the two arguments is not a Boolean expression, the operator returns `_?_`.

### Logical or `%` :

Description: Logical or of two Boolean values defined by the following truth table:

`A` | `B` | `A % B`
`false` | `false` | `false`
`false` | `true` | `true`
`true` | `false` | `true`
`true` | `true` | `true`

If one of the two arguments is not a Boolean expression, the operator returns `_?_`.

### Logical not `!`:

Description: Logical not of one Boolean value defined by the following truth table:

`A` | `!A`
`false` | `true`
`true` | `false`

If the argument is not a Boolean expression, the operator returns `_?_`.

## Functional Operators

### Logical and `and(,)`:

Description: `and(x,y)` is equivalent to `x & y`.

### Logical or `or(,)`:

Description: `or(x,y)` is equivalent to `x % y`.

### Logical not `not()`:

Description: `not(x)` is equivalent to `!x`.

### Logical exclusive or `xor(,)`:

Description: Logical exclusive or of two Boolean values defined by the following truth table:

`A` | `B` | `xor(A,B)`
`false` | `false` | `false`
`false` | `true` | `true`
`true` | `false` | `true`
`true` | `true` | `false`

If one of the two arguments is not a Boolean expression, the operator returns `_?_`.

## Type Predicates

The following predicates test whether the expression `` belongs to a certain class of objects. The predicates are important in defining functions whose behavior depends on the type of input expressions. Furthermore, these arguments are very useful for debugging, since they can be used to test assertions on the typing of the values in a program.

### Logical exclusive or `isinteger()`:

Description: This operator tests whether the expression `` is an integer.

### Logical exclusive or `isreal()`:

Description: This operator tests whether the expression `` is a real number. Note that integers are also real numbers.

### Logical exclusive or `iscomplex()`:

Description: This operator tests whether the expression `` is a complex number. Note that real numbers are also complex numbers.

### Logical exclusive or `iseven()`:

Description: This operator tests whether the expression `` is an even integer.

### Logical exclusive or `isodd()`:

Description: This operator tests whether the expression `` is an odd integer.

### Logical exclusive or `islist()`:

Description: This operator tests whether the expression `` is a list.

### Logical exclusive or `ismatrix()`:

Description: This operator tests whether the expression `` has the shape of a matrix. This means that the entries of the list are themselves lists, all of equal length. If there are n entries each of length m the expression represents an n × m matrix.

### Logical exclusive or `isnumbervector()`:

Description: This operator tests whether the expression `` is a list all of whose entries are numbers (integer, real, or complex).

### Logical exclusive or `isnumbermatrix()`:

Description: This operator tests whether the expression `` is a matrix all of whose entries are numbers (integer, real, or complex).

### Logical exclusive or `isstring()`:

Description: This operator tests whether the expression `` is a string.

### Logical exclusive or `isgeometric()`:

Description: This operator tests whether the expression `` represents a geometric element.

### Logical exclusive or `isselected()`:

Description: This operator tests whether the expression `` represents a geometric element and is selected.

### Logical exclusive or `ispoint()`:

Description: This operator tests whether the expression `` represents a geometric point.

### Logical exclusive or `isline()`:

Description: This operator tests whether the expression `` represents a geometric line.

### Logical exclusive or `iscircle()`:

Description: This operator tests whether the expression `` represents a geometric circle.

### Logical exclusive or `isconic()`:

Description: This operator tests whether the expression `` represents a geometric conic.

### Logical exclusive or `ismass()`:

Description: This operator tests whether the expression `` represents a CindyLab mass.

### Logical exclusive or `issun()`:

Description: This operator tests whether the expression `` represents a CindyLab sun.

### Logical exclusive or `isspring()`:

Description: This operator tests whether the expression `` represents a CindyLab spring.

### Logical exclusive or `isundefined()`:

Description: This operator tests whether the expression `` return an undefinedm element.

Page last modified on Wednesday 07 of June, 2006 [10:50:05 UTC].
The original document is available at http://doc.cinderella.de/tiki-index.php?page=Boolean%20Operators