You could replace all occurrences of zero in the denominator with infinity.
x=. 2 2 $ 2 y=. i. 2 2 x%y _ 2 1 0.666667 x%(y=0)}y,:_ 0 2 1 0.666667 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 > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
