complex.js
function(a, b) {

      var z = new Complex(a, b);

      // Infinity * 0 = NaN
      if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) {
        return Complex['NAN'];
      }

      // Infinity * z = Infinity { where z != 0 }
      if (this['isInfinite']() || z['isInfinite']()) {
        return Complex['INFINITY'];
      }

      // Short circuit for real values
      if (z['im'] === 0 && this['im'] === 0) {
        return new Complex(this['re'] * z['re'], 0);
      }

      return new Complex(
              this['re'] * z['re'] - this['im'] * z['im'],
              this['re'] * z['im'] + this['im'] * z['re']);
    }
function(a, b) {

      var z = new Complex(a, b);

      // Infinity * 0 = NaN
      if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) {
        return Complex['NAN'];
      }

      // Infinity * z = Infinity { where z != 0 }
      if (this['isInfinite']() || z['isInfinite']()) {
        return Complex['INFINITY'];
      }

      // Short circuit for real values
      if (z['im'] === 0 && this['im'] === 0) {
        return new Complex(this['re'] * z['re'], 0);
      }

      return new Complex(
              this['re'] * z['re'] - this['im'] * z['im'],
              this['re'] * z['im'] + this['im'] * z['re']);
    }
function ( a , b ) { var z = new Complex ( a , b ) ; // Infinity * 0 = NaN if ( ( this [ 'isInfinite' ] ( ) && z [ 'isZero' ] ( ) ) || ( this [ 'isZero' ] ( ) && z [ 'isInfinite' ] ( ) ) ) { return Complex [ 'NAN' ] ; } // Infinity * z = Infinity { where z != 0 } if ( this [ 'isInfinite' ] ( ) || z [ 'isInfinite' ] ( ) ) { return Complex [ 'INFINITY' ] ; } // Short circuit for real values if ( z [ 'im' ] === 0 && this [ 'im' ] === 0 ) { return new Complex ( this [ 're' ] * z [ 're' ] , 0 ) ; } return new Complex ( this [ 're' ] * z [ 're' ] - this [ 'im' ] * z [ 'im' ] , this [ 're' ] * z [ 'im' ] + this [ 'im' ] * z [ 're' ] ) ; }
Multiplies two complex numbers

@returns {Complex}
Multiplies two complex numbers