Oh, I see - yes, as long as the values are represented precisely, yes.

Basically:

terminates=:4 :0
  (q:x) -:&(*./) x ,&q: {:2 x:y
)

   60 terminates 1r120
1
   60 terminates 1r121
0

Thanks,

-- 
Raul


On Wed, Jun 13, 2018 at 3:51 PM William Tanksley, Jr
<[email protected]> wrote:
>
> No need to specify the precision if the input is actually rational numbers,
> not floating point numbers.
>
> On Wed, Jun 13, 2018 at 12:47 PM Raul Miller <[email protected]> wrote:
>
> > You would also have to specify the precision of the result.
> >
> > Put different: if that specification is too precise (pushing the
> > limits of what floating point numbers can represent), the algorithm
> > would degrade to meaninglessness because of floating point
> > inaccuracies. And, if that specification was not precise enough then
> > you wouldn't be able to represent many values.
> >
> > Something like six digits of decimal (base 10 (base 10 (base 10
> > (...)))) precision might be a sweet spot.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Wed, Jun 13, 2018 at 3:34 PM William Tanksley, Jr
> > <[email protected]> wrote:
> > >
> > > You could do this with rational numbers, since whether or not they
> > > terminate IS an interesting puzzle. Of course, you have to specify a
> > > "decimal" base -- 1/3 doesn't terminate base 10, but does terminate base
> > 60.
> > >
> > > On Wed, Jun 13, 2018 at 12:26 PM Raul Miller <[email protected]>
> > wrote:
> > >
> > > > Floating point numbers implicitly terminate in infinitely repeating
> > > > zeros after the 52 expressed bits of mantissa.
> > > >
> > > > Or, put differently, when we need to represent numbers which have
> > > > non-zero bits that can't be represented, we approximate. Or, another
> > > > view of floating point numbers is that they each represent an infinity
> > > > of values which divide the number line between the preceding and
> > > > following values (with a few special cases, like the ininities).
> > > >
> > > > I hope this helps in your efforts to express what you are looking
> > for...
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Raul
> > > > On Wed, Jun 13, 2018 at 3:23 PM Skip Cave <[email protected]>
> > wrote:
> > > > >
> > > > > Ok. Then I redefine my question:
> > > > >
> > > > > Given the vector a:
> > > > >
> > > > > ]a =. % 1+i.20
> > > > >
> > > > > 1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 0.1
> > 0.0909091
> > > > > 0.0833333 0.0769231 0.0714286 0.0666667 0.0625 0.0588235 0.0555556
> > > > > 0.0526316 0.05
> > > > >
> > > > >
> > > > > Define a verb that will find all the floating-point numbers in a that
> > > > will
> > > > > eventually terminate in infinitely repeating zeros.
> > > > >
> > > > >
> > > > > Skip
> > > > >
> > > > >
> > > > > On Wed, Jun 13, 2018 at 2:12 PM Henry Rich <[email protected]>
> > wrote:
> > > > >
> > > > > > The trailing 0 repeats forever.
> > > > > >
> > > > > > Henry Rich
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > ----------------------------------------------------------------------
> > > > > 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to