UNPKG

@rayyamhk/complex

Version:

A lightweight and easy-to-use library for you to manipulate complex numbers

16 lines (14 loc) 417 B
"use strict"; /** * Calculates the modulus of a Complex Number.<br><br> * * The modulus of the complex number is the length of the vector * representing the complex number on complex plane. * @memberof Complex * @instance * @returns {number} The modulus of the Complex Number */ function getModulus() { return Math.sqrt(Math.pow(this.re, 2) + Math.pow(this.im, 2)); } module.exports = getModulus;