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

Function boxHold

src/compute-engine/boxed-expression/box.ts:148–176  ·  view source on GitHub ↗
(
  ce: ComputeEngine,
  expr: ExpressionInput | null,
  options: { canonical?: CanonicalOptions }
)

Source from the content-addressed store, hash-verified

146 * - if `numericApproximation` is true, always return an approximation
147 *
148 * NUMERIC APPROXIMATION = FALSE
149 * - 2 + 5 -> 7
150 * - 2 + 5/7 -> 19/7
151 * - 2 + √2 -> 2 + √2
152 * - 2 + √(5/7) -> 2 + √(5/7)
153 * - 5/7 + 9/11 -> 118/77
154 * - 5/7 + √2 -> 5/7 + √2
155 * - 10/14 + √(18/9) -> 5/7 + √2
156 * - √2 + √5 -> √2 + √5
157 * - √2 + √2 -> 2√2
158 * - sin(2) -> sin(2)
159 * - sin(pi/3) -> √3/2
160 * - 2 + 2.1 -> 2 + 2.1
161 *
162 * NUMERIC APPROXIMATION = TRUE
163 * - 2 + 2.1 -> 4.1
164 * - 2 + √2.1 -> 3.44914
165 * - 5/7 + √2.1 -> 2.16342
166 * - sin(2) + √2.1 -> 2.35844
167 */
168
169/**
170 * Translate a public `FormOption` to the internal
171 * `{ canonical, structural }` representation.
172 */
173/**
174 * Boxing options for an operand boxed raw (unbound, uncanonicalized) from
175 * inside the boxer — what `ce.expr(x, { form: 'raw' })` resolves to. Sites on
176 * the recursive boxing path use `box(ce, x, RAW_OPERAND)` directly rather than
177 * the public `ce.expr()`, which re-enters through the scope plumbing (five
178 * frames per operand) to install a scope that is already the current one.
179 */

Callers 1

boxFunctionFunction · 0.85

Calls 3

missingIfEmptyFunction · 0.90
boxFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected