On Mon, Feb 21, 2022 at 2:23 PM R.E. Boss <r.e.b...@outlook.com> wrote:
>    round=: [ * [: <. 0.5 + %~

Looking closer at this, this was a bit different from my initial attempt.

Also, a version which rounds to the nearest integer is good up through
cyclotomic 70.

71 is a prime number, so we should expect (71#1) as the result for 71,
but with this version of round we get non-integer values for 71. (And,
rounding to the nearest integer gets us zeros for 71.)

Still, it's great for values smaller than 71 (though 0.001 round also
has non-integer values for 67). The first non-prime value where this
approach has problems is 85 (or 91 if we round to the nearest
integer).

And, it is interesting -- if you don't mind, I'll put a modified
version of it up on rosettacode.

Thanks,

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

Reply via email to