Once you accept that 0%0 is 0, a lot of NaNs go away.
Henry Rich
On 3/5/2018 10:17 AM, Raul Miller wrote:
For completeness, here's the fixed floydrecon:
floydrecon=: verb define
n=. ($y)$_(I._=,y)},($$i.@#)y
for_j. i.#y do.
d=. y <. j ({"1 +/ {) y
b=. y~:d
y=. d
n=. (n*-.b)+b * j{"1 n
end.
)
The problem with the earlier version was that 0 * _ is 0 and not
infinity. (Though, now that I think about this, I'm wondering about
why this doesn't throw a NaN error ... perhaps because the problem
occurs so often that NaN errors would be needlessly disruptive?)
This version deals with that by avoiding the use of arithmetic on
infinities when computing n.
---
This email has been checked for viruses by AVG.
http://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm