I don't see that tolerant comparisons are always used. But I agree that
f/.!.t seems to change the comparison tolerance for f, which in my
opinion is an error.
z =. 3 + 1e_15 * i. 8
</.~ z
+---------------+
|3 3 3 3 3 3 3 3|
+---------------+
</.!.0~ z
+-+-+-+-+-+-+-+-+
|3|3|3|3|3|3|3|3|
+-+-+-+-+-+-+-+-+
<@:>./.!.0 z
+-+-+-+-+-+-+-+-+
|3|4|4|4|4|4|4|4|
+-+-+-+-+-+-+-+-+
<@:(>.!.5e_14)/.!.0 z
+-+-+-+-+-+-+-+-+
|3|3|3|3|3|3|3|3|
+-+-+-+-+-+-+-+-+
Henry Rich
On 9/6/2010 1:40 PM, Don Guinn wrote:
> Played with f/. and tolerance some more. Surprising! /. always does tolerant
> comparisons when grouping. Including when 9!:18 is zero. And when tolerance
> is applied to /. it will apply the tolerance to a named verb.
>
> z
> 1 3 2 2 3 1 1 2 2 3
> z-<.z
> 2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14 2.88658e_14 2.90878e_14
> 2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14
> f=.[:<[=[:<.]
> f
> +--+-+---------------+
> |[:|<|+-+-+---------+|
> | | ||[|=|+--+--+-+||
> | | || | ||[:|<.|]|||
> | | || | |+--+--+-+||
> | | |+-+-+---------+|
> +--+-+---------------+
> f/.~z
> +-----+-----+-------+
> |1 1 1|1 1 1|1 1 1 1|
> +-----+-----+-------+
> f/.!.0~z
> +-----+-----+-------+
> |0 0 0|0 0 0|0 0 0 0|
> +-----+-----+-------+
> f z
> +-------------------+
> |1 1 1 1 1 1 1 1 1 1|
> +-------------------+
> f!.0 z
> |domain error
> | f!.0~z
> 9!:19]0
>
> f/.~z
> +-----+-----+-------+
> |0 0 0|0 0 0|0 0 0 0|
> +-----+-----+-------+
> 9!:19]ct
> ct
> 5.68434e_14
> f/.~z
> +-----+-----+-------+
> |1 1 1|1 1 1|1 1 1 1|
> +-----+-----+-------+
>
> I am not really sure what /. uses for the comparison tolerance for grouping.
>
> z2=.1 3 2 2 3 1 1 2 2 3+3*ct*?10#0
> z2
> 1 3 2 2 3 1 1 2 2 3
> z2=<.z2
> 1 1 0 0 1 1 1 1 0 1
> f z2
> +-------------------+
> |1 1 0 0 1 1 1 1 0 1|
> +-------------------+
> f/.~z2
> +-----+-----+-------+
> |1 1 1|1 1 1|0 0 1 0|
> +-----+-----+-------+
>
> Above the numbers close are grouped together as if equal, yet when they are
> compared in f they are found to be not tolerably equal.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm