[Jprogramming] Puzzling result
Erling Hellenäs
erling at erlinghellenas.se
Thu Sep 14 09:57:35 UTC 2017
Here we can see that the identities for Floor and Ceiling of R. H.
Lathwell holds for our example.
9!:19 [ 5.68434e_14
9!:18''
5.68434e_14
25j5":a=: 5729082486784839 % 196
29230012687677.75000
<. a
29230012687678
>.a
29230012687678
(<.a)<:a
1
(>.a)>:a
1
(>.a)=-<.-a
1
9!:19 [ 0
<. a
29230012687677
>.a
29230012687678
(<.a)<:a
1
(>.a)>:a
1
(>.a)=-<.-a
1
Cheers,
Erling Hellenäs
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
>> <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
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list