[Jprogramming] Puzzling result

Erling Hellenäs erling at erlinghellenas.se
Thu Sep 14 09:29:51 UTC 2017


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 <erling at erlinghellenas.se>
> 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



More information about the Programming mailing list