So I'm thinking something like this, to find exact numbers in a floating point array:
pps 15 NB. Set the print precision. Create a mixed floating point vector b: ]b=:(,3? 10^1+i.4),%a=:1+i.20 0 2 7 36 93 57 808 875 559 4674 8635 6196 1 0.5 0.333333333333333 0.25 0.2 0.166666666666667 0.142857142857143 0.125 0.111111111111111 0.1 0.0909090909090909 0.0833333333333333 0.0769230769230769 0.0714285714285714 0.0666666666666667 0.0625 0.0588235294117... Create a "find exact" verb 'fe' where x=the number of digits max that can be exact, and y is the vector to be tested (boolean result): fe=. 4 : 'x> ># each ": each <"1,.y' ]c=.9 fe b 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 Show exact: c#b 0 2 7 36 93 57 808 875 559 4674 8635 6196 1 0.5 0.25 0.2 0.125 0.1 0.0625 0.05 Show inexact: (-.c)#b 0.333333333333333 0.166666666666667 0.142857142857143 0.111111111111111 0.0909090909090909 0.0833333333333333 0.0769230769230769 0.0714285714285714 0.0666666666666667 0.0588235294117647 0.0555555555555556 0.0526315789473684 #b 32 #c#b 20 I'm sure this scheme has some holes, but it is a reasonable first cut. Skip ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm