Re: [Jbeta] complex numbergcd and residue failure

2012-06-24 Thread Jim Russell
On iPhone:
  5j11 +. 3j7 
1j1
   3j7|5j11
_1j_3




On Jun 24, 2012, at 5:45 AM, bill lam bbill@gmail.com wrote:

 I compiled jconsole for android and there were some test failed, in
 particular the complex number gcd and residue ,
 
 5j11 +. 3j7 
 
 linux   1j1 (correct)
 android 5j11
 
 
 3j7|5j11
 
 linux_1j_3 (somewhat correc, should be 2j4 according doj)
 android  _5j7
 
 It would be helpful if someone can also test it on iOS or android.  Thanks.
 
 -- 
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm


Re: [Jbeta] complex numbergcd and residue failure

2012-06-24 Thread bill lam
Thank Jim!

After hours of debug, I finally tracked down there was a regression
in the following commit made by Marshall Lochbaum. The change of
behavior in complex residue breaks +. and *. 

I suggest authors should run the test suite before commiting patches
into repos.


commit 223dbeab4e80ff8576f4044f9bfa6ffee84cc032
Author: Marshall Lochbaum mlochb...@gmail.com
Date:   Fri Feb 3 15:05:37 2012 -0500

changed behavior of complex dyad | to be consistent with real |

diff --git a/vz.c b/vz.c
index a5e38c8..74b6b97 100644
--- a/vz.c
+++ b/vz.c
@@ -87,14 +87,17 @@ ZF2(jtzrem){D a,b,d;Z q;
  }
  ZASSERT(!ZINF(u),EVNONCE);
  d=u.re*u.re+u.im*u.im;
- a=u.re*v.re+u.im*v.im; q.re=tfloor(0.5+a/d); 
- b=u.re*v.im-u.im*v.re; q.im=tfloor(0.5+b/d);
+ a=u.re*v.re+u.im*v.im; q.re=tfloor(a/d); 
+ b=u.re*v.im-u.im*v.re; q.im=tfloor(b/d);
  R zminus(v,ztymes(u,q));
 }
 
 ZF2(jtzgcd){D a,b;Z t,z;
  ZASSERT(!(ZINF(u)||ZINF(v)),EVNAN);
- while(ZNZ(u)){t=zrem(u,v); v.re=u.re; v.im=u.im; u.re=t.re; u.im=t.im;}
+ while(ZNZ(u)){
+  t=zrem(u,v); if(t.rev.re/2)t.re-=v.re; if(t.imv.im/2)t.im-=v.im;
+  v.re=u.re; v.im=u.im; u.re=t.re; u.im=t.im;
+ }
  z.re=a=v.re; z.im=b=v.im;
  switch(2*(0a)+(0b)){
   case 0: if(!a){z.re= b; z.im=0;}break;


Вск, 24 Июн 2012, Jim Russell писал(а):
 On iPhone:
   5j11 +. 3j7 
 1j1
3j7|5j11
 _1j_3
 
 
 
 
 On Jun 24, 2012, at 5:45 AM, bill lam bbill@gmail.com wrote:
 
  I compiled jconsole for android and there were some test failed, in
  particular the complex number gcd and residue ,
  
  5j11 +. 3j7 
  
  linux   1j1 (correct)
  android 5j11
  
  
  3j7|5j11
  
  linux_1j_3 (somewhat correc, should be 2j4 according doj)
  android  _5j7
  
  It would be helpful if someone can also test it on iOS or android.  Thanks.
  
  -- 
  regards,
  
  GPG key 1024D/4434BAB3 2008-08-24
  gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
  --
  For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,

GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
--
For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jbeta] complex numbergcd and residue failure

2012-06-24 Thread Jim Russell
You are welcome. I envy your ability to even spot the error, let alone your 
success diagnosing and fixing it. 
Indeed, thank you!


On Jun 24, 2012, at 1:55 PM, bill lam bbill@gmail.com wrote:

 Thank Jim!
 
 After hours of debug, I finally tracked down there was a regression
 in the following commit made by Marshall Lochbaum. The change of
 behavior in complex residue breaks +. and *. 
 
 I suggest authors should run the test suite before commiting patches
 into repos.
 
 
 commit 223dbeab4e80ff8576f4044f9bfa6ffee84cc032
 Author: Marshall Lochbaum mlochb...@gmail.com
 Date:   Fri Feb 3 15:05:37 2012 -0500
 
changed behavior of complex dyad | to be consistent with real |
 
 diff --git a/vz.c b/vz.c
 index a5e38c8..74b6b97 100644
 --- a/vz.c
 +++ b/vz.c
 @@ -87,14 +87,17 @@ ZF2(jtzrem){D a,b,d;Z q;
  }
  ZASSERT(!ZINF(u),EVNONCE);
  d=u.re*u.re+u.im*u.im;
 - a=u.re*v.re+u.im*v.im; q.re=tfloor(0.5+a/d); 
 - b=u.re*v.im-u.im*v.re; q.im=tfloor(0.5+b/d);
 + a=u.re*v.re+u.im*v.im; q.re=tfloor(a/d); 
 + b=u.re*v.im-u.im*v.re; q.im=tfloor(b/d);
  R zminus(v,ztymes(u,q));
 }
 
 ZF2(jtzgcd){D a,b;Z t,z;
  ZASSERT(!(ZINF(u)||ZINF(v)),EVNAN);
 - while(ZNZ(u)){t=zrem(u,v); v.re=u.re; v.im=u.im; u.re=t.re; u.im=t.im;}
 + while(ZNZ(u)){
 +  t=zrem(u,v); if(t.rev.re/2)t.re-=v.re; if(t.imv.im/2)t.im-=v.im;
 +  v.re=u.re; v.im=u.im; u.re=t.re; u.im=t.im;
 + }
  z.re=a=v.re; z.im=b=v.im;
  switch(2*(0a)+(0b)){
   case 0: if(!a){z.re= b; z.im=0;}break;
 
 
 Вск, 24 Июн 2012, Jim Russell писал(а):
 On iPhone:
  5j11 +. 3j7 
 1j1
   3j7|5j11
 _1j_3
 
 
 
 
 On Jun 24, 2012, at 5:45 AM, bill lam bbill@gmail.com wrote:
 
 I compiled jconsole for android and there were some test failed, in
 particular the complex number gcd and residue ,
 
 5j11 +. 3j7 
 
 linux   1j1 (correct)
 android 5j11
 
 
 3j7|5j11
 
 linux_1j_3 (somewhat correc, should be 2j4 according doj)
 android  _5j7
 
 It would be helpful if someone can also test it on iOS or android.  Thanks.
 
 -- 
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
 
 -- 
 regards,
 
 GPG key 1024D/4434BAB3 2008-08-24
 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
 --
 For information about J forums see http://www.jsoftware.com/forums.htm
--
For information about J forums see http://www.jsoftware.com/forums.htm