- Timestamp:
- 01/05/12 19:56:03 (17 months ago)
- Files:
-
- 1 modified
-
lang/javascript/math-complex/trunk/complex.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/math-complex/trunk/complex.js
r39098 r39099 1 1 /* 2 * $Id: complex.js,v 0.1 2 2012/01/05 09:49:18dankogai Exp dankogai $2 * $Id: complex.js,v 0.13 2012/01/05 10:51:24 dankogai Exp dankogai $ 3 3 * 4 4 * Licensed under the MIT license. … … 96 96 }, 97 97 pow: function(that) { 98 if (that.constructor === this.constructor) { 99 return that.mul(this.log()).exp(); 100 }else { 101 if (this.re < 0) return this.pow(new CPLX(that, 0)); 102 var abs = Math.pow(this.abs(), that * 1), 103 arg = this.arg() * that * 1; 104 return new CPLX( 105 abs * Math.cos(arg), 106 abs * Math.sin(arg) 107 ); 108 } 98 return (that.constructor === this.constructor) 99 ? that.mul(this.log()).exp() 100 : (new CPLX(that, 0)).mul(this.log()).exp(); 109 101 }, 110 102 sqrt: function() {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)