# Ordinal Data - Comparison Operator (Order, Equality)

> (Data|State) Management and Processing > Ordinal Data - Sorting problem Algorithm

### Table of Contents

## 1 - About

Comparison Operator

All comparison operators have the same priority, which is lower than that of all numerical operators.

A comparison operator test the order relationship between two operands and returns a Boolean.

The result of a comparison is a Boolean

Comparison Operator are tiddly coupled with the order and equivalence notion in order to sort data.

## 2 - Articles Related

## 3 - Chain

Comparisons may be chained.

For example, `a < b == c`

tests whether:

`a < b`

- and moreover
`b == c`

## 4 - Relation

Comparison operator models two kind of relation:

- Order Relation
- and Equivalence Relation

Binary relation are used in many branches of mathematics to model this relation. See Data Modeling - Binary Relation.

### 4.1 - Order relation

Order relation, including strict orders:

- greater than
- greater than or equal to
- less than
- less than or equal to
- divides (evenly)
- is a subset of

### 4.2 - Equivalence relation

- equality
- is parallel to (for affine spaces)
- is in bijection with
- isomorphy

## 5 - Combination

Comparisons may be combined using the Boolean operators `and`

and `or`

.

## 6 - List

### 6.1 - Order

Operation | Description |
---|---|

< | strictly less than |

<= | less than or equal |

> | strictly greater than |

>= | greater than or equal |

in | check whether a value occurs in a list |

not in | check whether a value does not occur in a list |