I think floor will go to the integer above if it's within comparison
tolerance.

On Sep 13, 2017 10:31 AM, "Raul Miller" <[email protected]> wrote:

> Tolerance is an ugly thing, I guess.
>
> http://code.jsoftware.com/wiki/Essays/Tolerant_Comparison
>
> Thanks,
>
> --
> Raul
>
>
> On Wed, Sep 13, 2017 at 11:23 AM, Erling Hellenäs
> <[email protected]> wrote:
> > Floor and ceiling and eq in j all uses comparison tolerance, So when the
> > result is set to 0 if floor and ceiling are equal in the J sense, we get
> the
> > zero result. The question s then if this is the correct behaviour.
> >
> > As we can see floor uses comparison tolerance. It is not obvious to me
> why.
> > It is not a comparison. If it didn't, we would get the correct result.
> >
> > Another possibility is to use comparison tolerance = 0 for floor and
> ceiling
> > only here, if that would be what we consider correct behaviour.
> >
> >      q=: 5729082486784839 % 196
> >
> >      30j5":q
> > 29230012687677.75000
> >      30j5":<.q
> > 29230012687678.00000
> >      30j5":>.q
> > 29230012687678.00000
> >      30j5":(>.q) = <.q
> > 1.00000
> >
> >
> > 9!:19]0
> >
> >
> > 30j5":q
> >
> > 29230012687677.75000
> >
> > 30j5":<.q
> >
> > 29230012687677.00000
> >
> > 30j5":>.q
> >
> > 29230012687678.00000
> >
> > 30j5":(>.q) = <.q
> >
> > 0.00000
> >
> >
> > Cheers,
> >
> >
> > Erling
> >
> >
> >
> > Den 2017-09-13 kl. 16:34, skrev Raul Miller:
> >>
> >> Hmm... actually... no...
> >>
> >> The relevant implementation here is in ve.c:
> >>
> >> static D jtremdd(J jt,D a,D b){D q,x,y;
> >>   if(!a)R b;
> >>   ASSERT(!INF(b),EVNAN);
> >>   if(a==inf )R 0<=b?b:a;
> >>   if(a==infm)R 0>=b?b:a;
> >>   q=b/a; x=tfloor(q); y=tceil(q); R teq(x,y)?0:b-a*x;
> >> }
> >>
> >> No hint of fmod here (though it does get used elsewhere).
> >>
> >> FYI,
> >>
> >
> > ----------------------------------------------------------------------
> > 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