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