I was playing around a little with complex <. and noticed a strange anomaly.
>From the Dictionary model of <.

   '`c1 c2 fp ip'=:(1:>+/@fp)`(>:/@fp)`(+.-ip)`(<[EMAIL PROTECTED])
   floor=: j./@(ip+(c2>c1),c1+:c2)"0
   <. 3j4 +1j1*10%~i.10
3j4 3j4 3j4 3j4 3j4 4j4 4j4 4j4 4j4 3j5
   floor 3j4 +1j1*10%~i.10
3j4 3j4 3j4 3j4 3j4 4j4 4j4 4j4 4j4 4j4
   <. 7j8 +1j1*10%~i.10
7j8 7j8 7j8 7j8 7j8 8j8 8j8 8j8 7j9 8j8
   floor 7j8 +1j1*10%~i.10
7j8 7j8 7j8 7j8 7j8 8j8 8j8 8j8 8j8 8j8

The implementation produces a different result from the model for the values
3.9j4.9 and 7.8j8.8 (and others should not be hard to find).

Granted, this value lies right along a line separating two regions, and
floating-point inaccuracies would explain why a number might stray slightly
to one side or other of this line, but tolerant comparisons should remove
such artifacts. The anomaly looks particularly heinous in the second case,
since it interrupts the linear progression of values.

If the models for the verbs c2 is changed to use an intolerant >:!.0/@fp
the model conforms to the implementation. Making a similar change to c1
does not seem to have any effect in this case.

My question is: should the model be changed to conform to the implementation?
or vice versa? It seems like the results are more intuitive if the tolerant
comparisons of the model are used.

-- Mark D. Niemiec <[EMAIL PROTECTED]>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to