Changeset 38265

Show
Ignore:
Timestamp:
08/14/10 04:22:57 (3 years ago)
Author:
dankogai
Message:

unbelievably sub() was wrong. fixed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/math-complex/trunk/complex.js

    r38264 r38265  
    11/* 
    2  * $Id: complex.js,v 0.3 2010/08/13 17:39:18 dankogai Exp dankogai $ 
     2 * $Id: complex.js,v 0.4 2010/08/13 19:18:44 dankogai Exp dankogai $ 
    33 */ 
    44 
     
    3838        sub:function(that){ 
    3939            return (that.constructor === this.constructor) 
    40                 ? new Math.Complex(this.re - that.re, this.im + that.im) 
     40                ? new Math.Complex(this.re - that.re, this.im - that.im) 
    4141                : new Math.Complex(this.re - that*1,  this.im); 
    4242        }, 
     
    8585                ); 
    8686            } 
    87         } 
     87        }, 
     88        eq:function(that){ 
     89            if (that.constructor === this.constructor){ 
     90                return this.re === that.re && this.im === that.im; 
     91            }else{ 
     92                return this.eq(new Math.Complex(that, 0)); 
     93            } 
     94        }, 
     95        lt:function(that){ 
     96            if (that.constructor === this.constructor){ 
     97                return this.re === that.re && this.im === that.im; 
     98            }else{ 
     99                return this.lt(new Math.Complex(that, 0)); 
     100            } 
     101        }, 
    88102    }; 
    89103    /* functions exported for convenience */