J’s "extended" arithmetic sometimes makes programming simpler but some other 
times more difficult; and I am afraid this "feature" is here to stay.  You can 
circumvent it by using a cover verb for (dyadic) %.  For example, if full rank 
is sufficient and some loss of performance is not an issue the following might 
help:
   
   over=. [ % [:^:(+./@:(0 = ,@:]))
      
   I=. >:@i. 10 100 1000
   J=. *:I
      
   I (% -: over) J
1
   
   st=. 7!:2 , 6!:2
   st'I over J'
16778112 0.094218958
   st'I %    J'
8389312 0.0358302522
   
   0 1 over 2 3
0 0.333333333
   
   0 1 over 0 3
|domain error: over
|   0 1     over 0 3
|[-0] 
   
   0 1 over 2 0
|domain error: over
|   0 1     over 2 0
|[-0] 
   
   %    b.0
0 0 0
   over b.0
_ _ _



From: Eldon Eller <[EMAIL PROTECTED]>
Forgive me for not being more clear. I am a super superannuated 
engineer. I and (by unwarranted projection) other engineers tend to use 
computers, and J in particular, as a superlative calculator. We may have 
occasion to evaluate an expression such as my example that results in 
0%0 without realizing it. I.e., we do not separately evaluate numerator 
and denominator. In such cases, J returns 0, which is the wrong answer, 
as demonstrated by application of l'Hospital's rule. J gives no warning 
that there is anything pathological in the expression. As a result, 
bridges are collapsing, planes are falling from the sky, cell phones are 
exploding, and wheels are coming off wagons.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to