You never showed what should be the correct results using your code! ]P=:0 1 0 1 u P 0 1 ]Q=: 0 0 0 0 0 0 0 0 0 0 u Q 0 0 0 0 0 Linda
-----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of David Lambert Sent: Friday, January 15, 2016 11:20 AM To: [email protected] Subject: Re: [Jprogramming] Round to nearest integer: harder than it seems F=: '(<.0.5+y)-.(>.y)-:"0>.0.5+y' f=: 13 : F u=: 13 :(;6{.;:F) v=: 13 :(;7}.;:F) g=: u -. v g f. ([: <. 0.5 + ]) -. >. -:"0 [: >. 0.5 + ] f ([: <. 0.5 + ]) -. >. -:"0 [: >. 0.5 + ] ]N=:100*?.4 5$0 3.8363 32.9284 33.5644 98.5972 5.83756 28.2326 69.186 72.943 77.0554 0.127296 41.691 18.7512 24.6726 89.5623 75.7084 9.47483 59.3199 11.9496 13.48 39.2216 u N 4 33 34 99 6 28 69 73 77 0 42 19 25 90 76 9 59 12 13 39 v N 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 None of the Boolean vectors of (v N) match vectors in (u N) What did you actually intend? Suppose there were a match, the shapes change. f 0 1 1 f 0 0 0 On 01/15/2016 01:00 AM, [email protected] wrote: > Date: Fri, 15 Jan 2016 00:44:06 -0500 > From: "Linda A Alvord"<[email protected]> > To:<[email protected]> > Subject: Re: [Jprogramming] Round to nearest integer: harder than it > seems > Message-ID: <000301d14f57$bfd93fd0$3f8bbf70$@net> > Content-Type: text/plain; charset=utf-8 > > When does this fail? > > ]N=:100*?4 5$0 > 97.1379 4.66292 33.0109 1.346 22.0004 > 60.0044 27.5797 96.3872 87.1029 67.5376 > 61.6793 57.1841 70.5857 62.2286 18.8883 > 58.1309 92.616 15.5295 76.6284 87.4544 > f=: 13 :'(<.0.5+y)-.(>.y)-:"0>.0.5+y' ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
