feat(Complex): Define return types of all operations

This commit is contained in:
Glen Whitney 2022-08-29 11:10:34 -04:00
parent de42c22ab4
commit 23b3ef4fdd
9 changed files with 44 additions and 16 deletions

View file

@ -49,6 +49,12 @@ describe('The default full pocomath instance "math"', () => {
math.abs(math.complex(2,1)) //TODO: ditto
assert.strictEqual(
math.returnTypeOf('abs','Complex<NumInt>'), 'number')
math.multiply(math.quaternion(1,1,1,1), math.quaternion(1,-1,1,-1)) // dit
const quatType = math.returnTypeOf(
'quaternion', 'NumInt,NumInt,NumInt,NumInt')
assert.strictEqual(quatType, 'Complex<Complex<NumInt>>')
assert.strictEqual(
math.returnTypeOf('multiply', quatType + ',' + quatType), quatType)
})
it('can subtract numbers', () => {