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

Function agmComplex

src/compute-engine/numerics/numeric-complex.ts:236–248  ·  view source on GitHub ↗
(a: Complex, b: Complex)

Source from the content-addressed store, hash-verified

234 return p >= MIN_NORMAL_DOUBLE && p < Infinity;
235}
236
237/**
238 * `a / b` for `complex.js` values, a drop-in replacement for `a.div(b)`
239 * that does not overflow or underflow when the quotient is in the range of a
240 * double. An ordinary quotient is `a.div(z)` itself, and only an out-of-range
241 * one pays for the scaling (see `scaledComplexDivide()`).
242 *
243 * A zero, infinite or NaN operand, and a real divisor (whose quotient
244 * `a.div()` computes part by part, without an intermediate value), are left
245 * to `a.div(b)`, so their results do not change: `x / 0` is the unsigned
246 * infinity `Complex.INFINITY`, `0 / 0` is `NaN`, `x / ∞` is `0`.
247 */
248export function complexDivide(a: Complex, b: Complex | number): Complex {
249 const z = typeof b === 'number' ? new Complex(b, 0) : b;
250 if (
251 z.im === 0 ||

Callers 1

ellipticKComplexFunction · 0.85

Calls 8

isZeroMethod · 0.65
mulMethod · 0.65
addMethod · 0.65
sqrtMethod · 0.65
absMethod · 0.65
subMethod · 0.65
negMethod · 0.65
isNaNMethod · 0.45

Tested by

no test coverage detected