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

Function eToTheI

test/compute-engine/power-combination.test.ts:229–233  ·  view source on GitHub ↗
(theta: Expression)

Source from the content-addressed store, hash-verified

227 test('e^{iπ/3} evaluates to an EXACT expression, not a float (Euler form)', () => {
228 // Regression: the Euler branch assembled the result with the `.add()`/
229 // `.mul()` methods, which fold the exact cos/sin literals (1/2, √3/2) to
230 // machine floats — violating the evaluate-vs-N exactness contract.
231 const e = engine.parse('e^{i\\pi/3}').evaluate();
232 // No decimal float appears in the serialization (exact radical/rational).
233 expect(e.toString()).toBe('1/2 + sqrt(3)/2i');
234 expect(e.isSame(engine.parse('\\frac12 + \\frac{\\sqrt3}{2}i'))).toBe(true);
235 // .N() still numericizes.
236 const n = e.N();

Callers 2

fFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected