Calculations with Complex Numbers in JavaScript