> You definitely need an upper bound (and a lower bound). Values like 10 > would be meaningless ...
A (relative) tolerance of 1 or greater is meaningless. See http://code.jsoftware.com/wiki/Essays/Tolerant_Comparison#Tolerance_Less_Than_1 On Fri, Aug 2, 2019 at 9:11 AM Raul Miller <rauldmil...@gmail.com> wrote: > On Thu, Aug 1, 2019 at 5:01 PM Nimp O <tr...@outlook.com> wrote: > > Perhaps this upper bound could be removed, at least for x:, since I > believe the main use cases for tolerance on this verb would be bigger > values, as illustrated in my earlier example. > > At least in this context, I can't see anything catastrophic happening by > increasing this tolerance, on the contrary. > > But maybe this change cannot be made in such an isolated way. > > You definitely need an upper bound (and a lower bound). Values like 10 > would be meaningless (and negative values are also meaningless). > > Here's an implementation of tolerant equality: > > teq=: |@- <: ".@'ct' * >.&| > > If ct were 1, then all numbers would be equal. Even values close to 1 > can be confusing: > > ct=:0.5 > 1 teq 2 > 1 > > If ct is 2^-n and n is an integer, n-1 approximately represents the > number of significant bits in the numbers being compared. > > This concept is important for floating point representation (and > "disastrous" for exact representations). > > That said, it might be useful to allow larger values than the current > implementation. (But how by much?) > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm