<div dir="ltr">As long as we're discussing bugs in expr, I found a new one in the newly added "Avg" function in 0.56, I just sent a fix, see <a href="https://github.com/pure-data/pure-data/pull/287">https://github.com/pure-data/pure-data/pull/287</a></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-09 18:41 GMT-03:00 Charles Z Henry <span dir="ltr"><<a href="mailto:czhenry@gmail.com" target="_blank">czhenry@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Jan 9, 2018 12:52 PM, "Alexandre Torres Porres" <<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-565113913287254079quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi list and Shahrokh. What do you think the output from factorial of negative values? I read it's supposed to be minus infinity. Anyway, here's a issue I'm reporting that factorial of negative values in [expr] output 0 and freeze Pd for a while: <a href="https://github.com/pure-data/pure-data/issues/284" target="_blank">https://github.com/pure-data/p<wbr>ure-data/issues/284</a></div></div></blockquote></div></div><div dir="auto"><br></div></span><div dir="auto">The most consistent treatment would be to give it some value, other than -inf, which will propagate into NaN's in other calculations. Otherwise, outputs depend more on how denormals get handled rather than how Pd code is written. Outputs could vary from system to system and that's just buggy.</div><div dir="auto"><br></div><div dir="auto">The factorial is generalized by the gamma function which has values at non-zero and non-integer negative values, but it likely doesn't have much practical use in Pd. You could write an external if it actually matters to you for a project.</div><div dir="auto"><br></div><div dir="auto">So.... Since there's little point in being mathematically literal about it, it's fine to just choose a value (0 or 1) for values less than 1.  If it's me, I would choose 1, so that factorial calculations have the same value for bad inputs (values <1) as for the trivial input (=1).</div><div dir="auto"><br></div><div dir="auto">Chuck</div><div class="gmail_extra" dir="auto"></div></div>
</blockquote></div><br></div>