Re: Odd Complex behavior

2019-06-14 Thread yary
I like Brad's > About the only change I would even consider is to add: > constant term:<-i> = Complex.new(0,-1); and opened https://github.com/rakudo/rakudo/issues/2986 -y -y On Fri, Jun 14, 2019 at 5:52 AM Brad Gilbert wrote: > About the only change I would even consider is to add: > >

Re: Odd Complex behavior

2019-06-14 Thread Elizabeth Mattijsen
True. Forget that idea then :-) > On 14 Jun 2019, at 13:27, Timo Paulssen wrote: > > That sounds like a recipe for even more confusion further down the road; now > whether you get a -0-i or a 0-i out of your bag depends on which one of the > two was put in first, and the difference between 0

Re: Odd Complex behavior

2019-06-14 Thread Brad Gilbert
About the only change I would even consider is to add: constant term:<-i> = Complex.new(0,-1); On Fri, Jun 14, 2019 at 6:27 AM Timo Paulssen wrote: > > That sounds like a recipe for even more confusion further down the road; > now whether you get a -0-i or a 0-i out of your bag depends on wh

Re: Odd Complex behavior

2019-06-14 Thread Timo Paulssen
That sounds like a recipe for even more confusion further down the road; now whether you get a -0-i or a 0-i out of your bag depends on which one of the two was put in first, and the difference between 0 and -0 surely makes a difference in enough cases when doing floating point math that it wou

Re: Odd Complex behavior

2019-06-13 Thread Elizabeth Mattijsen
We could potentially give 0e0 and -0e0 the same .WHICH, which would solve the bag issue. > On 13 Jun 2019, at 21:02, Timo Paulssen wrote: > > Unfortunately, that's what the IEEE prescribes, so all we can really do is: > *shrug* > > On 13/06/2019 21:01, Sean McAfee wrote: >> On Thu, Jun 13, 20

Re: Odd Complex behavior

2019-06-13 Thread Timo Paulssen
Unfortunately, that's what the IEEE prescribes, so all we can really do is: *shrug* On 13/06/2019 21:01, Sean McAfee wrote: On Thu, Jun 13, 2019 at 11:12 AM Brad Gilbert > wrote:     > (-i).reals     (-0 -1) Ah, so it's nothing particular to Complex: > bag

Re: Odd Complex behavior

2019-06-13 Thread Sean McAfee
On Thu, Jun 13, 2019 at 11:12 AM Brad Gilbert wrote: > > (-i).reals > (-0 -1) > Ah, so it's nothing particular to Complex: > bag 0e0, -0e0 bag(-0, 0) Can't say I'm thrilled to have two distinct zeroes.

Re: Odd Complex behavior

2019-06-13 Thread Brad Gilbert
> (-i).reals (-0 -1) > Complex.new(0, -1).reals (0 -1) > ((-1)i).reals (0 -1) This is precisely what I would expect to happen. There is a postfix `i` operator for things like `1i`, but there is also a constant `i` # from src/core/Complex.pm6 constant i = Complex.n

Odd Complex behavior

2019-06-13 Thread Sean McAfee
> bag i, 2i - i bag(0+1i(2)) Well and good. > bag -i, -2i + i bag(0-1i, -0-1i) Huh? But this works as expected: > bag Complex.new(0, -1), Complex.new(0, -2) + Complex.new(0, 1) bag(0-1i(2)) Is this a bug, or is there a sense in which it's correct?