bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Fuzzy Floor and Ceiling


From: Elias Mårtenson
Subject: Re: [Bug-apl] Fuzzy Floor and Ceiling
Date: Mon, 17 Aug 2015 00:15:14 +0800

It refers to "unit in the last place", essentially the size of smallest change for a floating point number of a given magnitude. The Wikipedia page explains more: https://en.wikipedia.org/wiki/Unit_in_the_last_place

Now, there is also this famous paper, which discusses this in great detail: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Regards,
Elias

On 15 August 2015 at 19:53, Juergen Sauermann <address@hidden> wrote:
Hi,

and what is ulps?

/// Jürgen


On 08/15/2015 01:15 PM, Elias Mårtenson wrote:
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 <address@hidden> 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]