How is this "why" ? it appears that all it does is substitute a number (in this case 1) rather than have NaN. I can see this as a way to avoid a NaN error by flagging it without stopping execution.- not as an explanation for the NaN using __%__

*ff=: % :: 9:*


__ ff __

9

    3 ff 2
1.5

also works with
*ff2=: - :: 9:*

__ ff2 __

9

4 ff2 1

3


Don

On 11/18/2015 8:28 PM, Linda A Alvord wrote:
Here's why...

    f=:0:@% ::1:
    _ f _
Linda
1
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Monday, November 16, 2015 1:46 PM
To: Programming forum
Subject: Re: [Jprogramming] Why is subtraction and division of rational numbers 
so hard?

You might also like to see:

    L=:(-_),(-2%~1-~%:5),0,(2%~1-~%:5),_
    0:@% ::1:"0/~ L
1 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1

Thanks,


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to