Eugene's work should be thought of as specification, rather than implementation.
That said, chasing through the various implementations of floor for the various C data types can be an interesting exercise. Thanks, -- Raul On Fri, Sep 15, 2017 at 4:36 AM, Erling Hellenäs <[email protected]> wrote: > Hi all ! > > Eugene mentions a circular dependency between Floor and Residue in his > paper. I didn't understand what would stop the recursion, so I tried it out, > and indeed, I got stack error. Didn't he test his theories? Have I > misunderstood something? Do I have a bug somewhere? > > See below. > > Cheers, > > Erling Hellenäs > > > fr=: 3 : 0 > > : > > if. ( x = 0 ) +. ( >.s ) = <. s =. y % x + x = 0 > > do. y * x = 0 > > else. y - x * <. s > > end. > > ) > > 9!:19 [ 5.68434e_14 > > > 9!:18'' > > 5.68434e_14 > > 2 fr 5 > > 1 > > a=: _5 + i. 11 > > b=: |. a > > a > > _5 _4 _3 _2 _1 0 1 2 3 4 5 > > b > > 5 4 3 2 1 0 _1 _2 _3 _4 _5 > > *./(0<:(a fr b)%a) *. ((a fr b)%a)<1 > > 1 > > m=: a > > z=: b > > *./z=(m*<.z%m)+m fr z > > 1 > > (14^2) fr 5729082486784839 > > 0 > > 196 fr 5729082486784839 > > 0 > > 9!:19 [ 0 > > > 9!:18'' > > 0 > > (14^2) fr 5729082486784839 > > 147 > > 196 fr 5729082486784839 > > 147 > > ff=: 3 : 0 > > NB. y - 1 fr y > > y - 1 | y > > ) > > fc=: 3 : 0 > > NB. - ff - y > > - ff - y > > ) > > fr=: 3 : 0 > > : > > if. ( x = 0 ) +. ( fc s ) = ff s =. y % x + x = 0 > > do. y * x = 0 > > else. y - x * ff s > > end. > > ) > > 9!:19 [ 5.68434e_14 > > > 9!:18'' > > 5.68434e_14 > > 2 fr 5 > > 1 > > ff 1.5 > > 1 > > fc 1.5 > > 2 > > a=: _5 + i. 11 > > b=: |. a > > a > > _5 _4 _3 _2 _1 0 1 2 3 4 5 > > b > > 5 4 3 2 1 0 _1 _2 _3 _4 _5 > > *./(0<:(a fr b)%a) *. ((a fr b)%a)<1 > > 1 > > m=: a > > z=: b > > *./z=(m*<.z%m)+m fr z > > 1 > > (14^2) fr 5729082486784839 > > 0 > > 196 fr 5729082486784839 > > 0 > > 9!:19 [ 0 > > > 9!:18'' > > 0 > > (14^2) fr 5729082486784839 > > 147 > > 196 fr 5729082486784839 > > 147 > > ff=: 3 : 0 > > y - 1 fr y > > NB. y - 1 | y > > ) > > fc=: 3 : 0 > > - ff - y > > NB.- ff - y > > ) > > 9!:19 [ 5.68434e_14 > > > 9!:18'' > > 5.68434e_14 > > 2 fr 5 > > |stack error: fc > > | (x=0)+.( fc s)=ff s=.y%x+x=0 > > > Den 2017-09-14 kl. 11:29, skrev Erling Hellenäs: >> >> Hi all ! >> >> I programmed Eugenes proposal, and indeed, it gives the same result for >> the actual problem that our Residue does. >> >> There are some other differences. >> >> Check me, there might well be some bug somewhere. >> >> fr=: 3 : 0 >> >> : >> >> if. ( x = 0 ) +. ( >.s ) = <. s =. y % x + x = 0 >> >> do. y * x = 0 >> >> else. y - x * <. s >> >> end. >> >> ) >> >> 9!:19 [ 5.68434e_14 >> >> 9!:18'' >> >> 5.68434e_14 >> >> 2 fr 5 >> >> 1 >> >> a=: _5 + i. 11 >> >> b=: |. a >> >> a >> >> _5 _4 _3 _2 _1 0 1 2 3 4 5 >> >> b >> >> 5 4 3 2 1 0 _1 _2 _3 _4 _5 >> >> *./(0<:(a fr b)%a) *. ((a fr b)%a)<1 >> >> 1 >> >> m=: a >> >> z=:b >> >> *./z=(m*<.z%m)+m fr z >> >> 1 >> >> (14^2) fr 5729082486784839 >> >> 0 >> >> 196 fr 5729082486784839 >> >> 0 >> >> 9!:19 [ 0 >> >> 9!:18'' >> >> 0 >> >> (14^2) fr 5729082486784839 >> >> 147 >> >> 196 fr 5729082486784839 >> >> 147 >> >> >> Cheers, >> >> >> Erling Hellenäs >> >> >> Den 2017-09-13 kl. 22:53, skrev Jimmy Gauvin: >>> >>> Fuzzy Residue by Eugene McDonnell is an enlightening source of >>> information >>> on residue even though it pertains to APL running on IBM hardware: >>> >>> http://www.jsoftware.com/papers/eem/residue1.htm >>> >>> Section 2 is about the relation between floor and residue >>> >>> Two other articles, Comparison Tolerance by Robert Bernecky and APL >>> Comparison Tolerance by R.H. Lathwell, are both available under this >>> link: >>> >>> http://www.jsoftware.com/papers/satn23.htm >>> >>> >>> >>> >>> On Wed, Sep 13, 2017 at 3:48 PM, Erling Hellenäs >>> <[email protected]> >>> wrote: >>> >>>> I looked briefly in those references. I don't see any statements about >>>> the >>>> use of comparison tolerance in Residue. /Erling >>>> >>>> On 2017-09-13 18:30, Raul Miller wrote: >>>> >>>>> Tolerance is an ugly thing, I guess. >>>>> >>>>> http://code.jsoftware.com/wiki/Essays/Tolerant_Comparison >>>>> >>>>> Thanks, >>>>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
