MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / compareFloat

Function compareFloat

src/compute-engine/boxed-expression/order.ts:190–200  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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
197const 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

Callers 2

equalOrderFunction · 0.85
orderFunction · 0.85

Calls 1

isNaNMethod · 0.45

Tested by

no test coverage detected