Arguably ⎕CT should be specified in terms of ulps, since GNU APL uses double precision floating point for all numeric operations.
On 15 August 2015 at 02:54, Mike Duvos <[email protected]> wrote: > Hi Jürgen, > > > Z← R For real numbers, yields the largest integer that does not exceed R > (within the comparison tolerance). > > > That is essentially what ISO says and what GNU APL has implemented. The > observed behavior > > of the IBM APL2 implementation seems to be (within R times the > comparison tolerance), > > which is probably unintentional. > > On page 58 of the APL2 Language Reference, it defines what "within > comparison tolerance" means and for two positive numbers, the fuzz factor > is ⎕CT times the larger of the magnitudes. It then lists floor and ceiling > as two of the many functions to which this applies. > > I cannot think of a single APL that doesn't relativize ⎕CT for floor and > ceiling, with the exception of this one. > > It's not a problem that relative tolerance can include more than one > integer in the interval as the magnitude increases, as you are only > checking if you are tolerantly equal to the nearest integer, which always > does the right thing. > > "within comparison tolerance" should be read as "according to the > previously discussed comparison tolerance algorithm" and not taken as a > mathematical statement about adding or subtracting ⎕CT, or contrasted with > "within R times comparison tolerance." > > Just as if they had said "modulo comparison tolerance," it would not imply > anything having to do with residue. > > If tolerant ⌊ and ⌈ are only going to do something special on 2049 > distinct integers, why not just do it without ⎕CT on everything, and call > it a "feature." > > Regards, > > Mike > > >
