|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] Modulo or residue function is not generating consistent complete residue systems for some arguments |
Date: | Fri, 23 Jun 2017 21:02:03 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Hi Frederick, I suppose that this is caused by a rounding error just before the complex floor. I have attached a debug version of ComplexCell.cc that prints every partial result of the computation. If I run it then I get: 5J3 | 14J5 modulus (A) is: (5,3) A=0 is: (0,0) A+A=0 is: (5,3) B÷A+A=0 is: (2.5,-0.5) ⌊B÷A+A=0 is: (3,-1) A×⌊B÷A+A=0 is: (18,4) B-A×⌊B÷A+A=0 is: (-4,1) ¯4J1 However if I use a slightly smaller B (kind of simulating a rounding error) then I get: 5J3 | 14J4.999999999 modulus (A) is: (5,3) A=0 is: (0,0) A+A=0 is: (5,3) B÷A+A=0 is: (2.4999999999118,-0.50000000014706) ⌊B÷A+A=0 is: (2,-1) A×⌊B÷A+A=0 is: (13,1) B-A×⌊B÷A+A=0 is: (1,3.999999999) 1J3.999999999 I suppose that is what happens on your machine but not on mine. You may also want to try out the following. In ComplexCell::bif_floor() around line 231 ff it says: // ISO: if D is tolerantly less than 1 return fr + 0J1×fi // IBM: if D is less than 1 return fr + 0J1×fi // However, ISO examples follow IBM (and so do we) // // if (D < 1.0 + Workspace::get_CT()) return zv(Z, fr, fi); // ISO if (D < 1.0) return zv(Z, fr, fi); // IBM and examples in ISO If you uncomment the first if statement then you get the ISO variant of bif_floor() while otherwise you get the IBM variant (which is also the one described in the McDonnel paper). It could be that the ISO variant works better for the bif_residue() function, but it causes problems in other places. If uncommenting the if line should fix your problem, then I can create two variants of bif_floor(): one for bif_residue() and one for the rest. Best Regards, Jürgen Sauermann On 06/23/2017 07:31 PM, Frederick Pitts
wrote:
|
ComplexCell.cc
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |