*PT-* To modify the (infinite) "zero-division" result from *infinity* to *zero*...
How about adding infinity to the divisor's zero-elements? *z =: x%y+_*y=0* ]x =. 2 2 $ 2 2 2 2 2 ]y =. 2 2 $ i.4 0 1 2 3 ]z =. x%y+_*y=0 0 2 1 0.666667 *-Robert Knight* (Also a J-newbie) On Fri, May 17, 2013 at 6:44 PM, P T <[email protected]> wrote: > I am learning J (J602) and dividing one table with another. When division > by zero occurs, I want the the value to be zero instead of infinity. For > example, in the results below, I want the first element to be 0.0 instead > of _ > > ]x =. 2 2 $ 2 > 2 2 > 2 2 > > ]y=. 2 2 $ i.4 > 0 1 > 2 3 > > x%y > _ 2 > 1 0.666667 > > > May be I can replace all occurrences of _ with 0.0. But, can I avoid this > additional step? > > Thanks, > PT > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
