feat: Add complex numbers
With just the operations we have for numbers, and overall tests.
This commit is contained in:
parent
536656bfe8
commit
32bc9ca515
8 changed files with 80 additions and 7 deletions
|
@ -12,4 +12,12 @@ describe('The default full picomath instance "math"', () => {
|
|||
(...addends) => addends.reduce((x,y) => x+y, '')])
|
||||
assert.strictEqual(math.add('Kilroy',' is here'), 'Kilroy is here')
|
||||
})
|
||||
|
||||
it('handles complex numbers', () => {
|
||||
assert.deepStrictEqual(math.complex(2,3), {re: 2, im: 3})
|
||||
assert.deepStrictEqual(
|
||||
math.subtract(16, math.add(3, math.complex(0,4), 2)),
|
||||
math.complex(11, -4))
|
||||
assert.deepStrictEqual(math.negate(math.complex(3, '8')).im, -8)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue