Fair enough - it substitutes rather than terminating a script due to an error.

Don

On 11/19/2015 6:02 AM, Linda A Alvord wrote:
It doesn't preserve the concept of _%_

But it does serve as an interesting mask for making images:

load 'viewmat'
L=:(-_),(-2%~1-~%:5),0,(2%~1-~%:5),_
f=:0:@% ::1:"0/~
[M=:f L
[A=: */~i.5
[GRB=:|.255*1 0 2{"1 #:i.8
[PAL=:GRB,3#0
PAL viewmat A
PAL viewmat (16*f L)>.A

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Don Kelly
Sent: Thursday, November 19, 2015 1:12 AM
To: [email protected]
Subject: Re: [Jprogramming] Why is subtraction and division of rational
numbers so hard?

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

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


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

Reply via email to