[PD] factorial of negative values in [expr] / expr 0.56
Charles Z Henry
czhenry at gmail.com
Tue Jan 9 22:41:01 CET 2018
On Jan 9, 2018 12:52 PM, "Alexandre Torres Porres" <porres at gmail.com> wrote:
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: https://github.com/pure-data/pure-data/issues/284
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.
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.
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).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pd-list