* Total three-way comparison of two floats suitable for a comparator. * * Unlike `af - bf`, this is a *total* order: it never returns `NaN`. Any * `NaN` operand sorts after all real numbers (and two `NaN`s compare equal), * so canonical ordering stays deterministic and permutation-invariant even
(a: number, b: number)
| 188 | return order(a, b); |
| 189 | } |
| 190 | |
| 191 | // export function isSorted(expr: Expression): Expression { |
| 192 | |
| 193 | // } |
| 194 | |
| 195 | // The "kind" of subexpressions. The order here indicates the |
| 196 | // order in which the expressions should be sorted |
| 197 | const RANKS = [ |
| 198 | 'integer', |
| 199 | 'rational', |
| 200 | 'radical', // Square root of a rational literal |
| 201 | 'real', |
| 202 | 'complex', |
| 203 | 'nan', // NaN: after all numbers, so it has a deterministic sort position |
no test coverage detected