( ce: ComputeEngine, ops: ReadonlyArray<Expression>, numericApproximation: boolean )
| 899 | // Symbolic data: stay inert rather than fold a valueless symbol to |
| 900 | // `NaN` — see `collectData`. One walk feeds both paths below. |
| 901 | const xs = collectData(ops); |
| 902 | if (xs === null) return undefined; |
| 903 | const nonReal = nonRealUnivariateError( |
| 904 | engine, |
| 905 | 'InterquartileRange', |
| 906 | xs |
| 907 | ); |
| 908 | if (nonReal) return nonReal; |
| 909 | // A datum with no real value leaves the sort with nothing to order by |
| 910 | // — see `hasValuelessDatum`. |
| 911 | if (hasValuelessDatum(xs)) return engine.NaN; |
| 912 | if (!numericApproximation) { |
| 913 | const vals = exactData(xs); |
| 914 | if (vals) { |
| 915 | const [q1, , q3] = exactQuartiles(engine, vals); |
| 916 | return subtract(engine, q3, q1); |
| 917 | } |
| 918 | } |
| 919 | return engine.number( |
| 920 | bignumPreferred(engine) |
| 921 | ? bigInterquartileRange(bigScalarsOf(xs)) |
| 922 | : interquartileRange(scalarsOf(xs)) |
| 923 | ); |
| 924 | }, |
| 925 | }, |
| 926 | |
| 927 | Histogram: { |
| 928 | description: |
| 929 | 'Compute a histogram of the values in a collection. Returns a list of (bin start, count) tuples.', |
| 930 | complexity: 8200, |
| 931 | // The bin spec accepts any number so Desmos-style `histogram(L, .05)` |
| 932 | // (bin *width*) parses; a non-integer count is inert at evaluate |
| 933 | // (`computeBinning` returns undefined) — width semantics are the |
| 934 | // importer's to translate (e.g. to explicit bin edges). |
| 935 | signature: |
no test coverage detected