> As a math teacher, I would be leery a about writing a way divide most
numbers by 0 to get 0.  It seems like writing code to have  14 % 2  result
 in a  5 or an 8.

Yes, if you are teaching math, but no in a business situation.

It could well be that you are working with a database where missing values
are stored as 0 (e.g. because a zero could not arise in practice). In such
a case, you may well want to have x%0 return 0 and not infinity.

On Sat, May 18, 2013 at 12:06 PM, Linda Alvord <[email protected]>wrote:

> In your example 0 is always divided by 0.
>
>    x=:6 6$4 0 0 0 0 0 0 5 0 0 0 0 0 0 6 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0
>    y=:6 6$1 0 0 0 0 0 0 2 0 0 0 0 0 0 3 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0
>    x%y
> 4   0 0    0 0 0
> 0 2.5 0    0 0 0
> 0   0 2    0 0 0
> 0   0 0 1.75 0 0
> 0   0 0    0 0 0
> 0   0 0    0 0 0
>
>    0%0
> 0
>
> As a math teacher, I would be leery a about writing a way divide most
> numbers by 0 to get 0.  It seems like writing code to have  14 % 2  result
>  in a  5 or an 8.
>
> Linda
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to