I held my nose and averted my eyes when I wrote the code for
x: on floating point arguments. The less said about it the better.
+. is defined in terms of | , which is tolerant. It can be
modelled as follows:
gcd=: {: @ (|/\@|.^:(0~:{.)^:_) @ , " 0
36 gcd 48
12
7 gcd 0.07
0.07
0.03 gcd 0.07
0.01
(2^30x) gcd !20x
262144
3j4 gcd 5j6
2j2
gcd/~ 0 1
0 1
1 1
----- Original Message -----
From: "John Randall" <[EMAIL PROTECTED]>
To: "Beta forum" <[email protected]>
Sent: Tuesday, March 28, 2006 3:36 PM
Subject: Re: [Jbeta] x: 4 * !19
Roger Hui wrote:
> On investigation I have discovered a bug in the x:
> routine in the part that handles floating point arguments
> whose magnitude is less than 1e_16 or greater than 1e16.
> For such arguments the result should be exactly 1%y
> or y where y is an integer. This is now fixed for the
> next beta, wherein:
>
>......
Roger:
Am I correct in assuming that monad x: uses something like (,%+.)&1 ?
If so, could you explain a little more than in the Dictionary how +.
works? I am guessing that a+.b is for a>b is figured out using Euclid's
algorithm by recursively writing
a=qb+r
except r is regarded as zero if r%a is (tolerantly) zero. Or is this way
off base?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm