Re: [q-lang-users] New stuff in cvs: multichar ops, views
Brought to you by:
agraef
From: Rob H. <hub...@gm...> - 2007-06-01 10:04:27
|
On 01/06/07, Eddie Rucker <ed...@bm...> wrote: > Albert Graef wrote, > > > I don't know any other language that has an > > infix operator to create complex numbers, does anyone else? > > What about Python: > > >>> 2+3j + 2-4i > (4-1j) > > Eddie But beware that Python doesn't really get this quite right: >>> (1+2j) * (3+4j) (-5+10j) >>> 1 + (2j*3) + 4j (1+10j) >>> 1+2j * 3+4j (1+10j) That is, the '+' and '*' operators have their usual precedences. There is no 'special' high-precedence operator for complex construction. Also, the latest 'C' standard (C99?) has support for imaginary and complex numbers, but I'm not sure of the lexing details... Rob. |