jstrachan | 3 May 16:40 2005
Picon

Re: Support Complex Number Calculation

LARSON, BRIAN (SBCSI) wrote:
> IMHO, I think this kind of thing should wait until 2.0 to allow 1.0 to
> be completed sooner. 

Agreed - we've enough on our plate to get 1.0 out of the door, which 
should be our top priority.

> -----Original Message-----
> From: phkim@...
[mailto:phkim@...] 
> Sent: Tuesday, April 19, 2005 8:23 AM
> To: jsr@...
> Subject: [groovy-jsr] Support Complex Number Calculation
> 
> 
> Hi all
> 
> I propose that Groovy supports the complex number calculation.
> The standard expression is x + yj or x + yJ, 
> where j or J means the imaginary symbol i.e. sqrt(-1).
> 
> For examples:
> 
> def c1 = 1.0 + 2.0j
> assert c1*c1 == -3.0 + 4.0j
> assert c1+c1 = 2.0 + 4.0j
> assert c1*1.0j = -2.0 + 1.0j
> assert 1.0/c1 == (1.0 - 2.0j)/Math.sqrt(5.0)
> 
> Or
> 
> def c1 = 1.0 + 2.0J
> assert c1*c1 == -3.0 + 4.0J
> assert c1+c1 = 2.0 + 4.0J
> assert c1*1.0j = -2.0 + 1.0J
> assert 1.0/c1 == (1.0 - 2.0J)/Math.sqrt(5.0)
>  
> 


Gmane