On Sun, Jan 16, 2022 at 12:34 PM 'Michael Day' via Programming
<programm...@jsoftware.com> wrote:
> I see that you (Raul) didn't bother with truncating divide towards
> zero.  In testing,  I fell foul of this,
> and used
>     divt =: {{ s * y <.@%~ | x   [ s =. * x }}
> ... but I think you're ok in the actual "program" as div only has
> positive input as far as I can see!

Yes...

More specifically, the puzzle instructions say:

"(Program authors should be especially cautious; attempting to execute
div with b=0 or attempting to execute mod with a<0 or b<=0 will cause
the program to crash and might even damage the ALU. These operations
are never intended in any serious ALU program.)"

And, the same Z value (y in my 'BLOCK' verb) is used with both DIV and MOD.

Thanks,

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

Reply via email to