[PD] pow/pow~ and negative input, a fix proposal

Alexandre Torres Porres porres at gmail.com
Wed May 9 03:28:38 CEST 2018

2018-05-08 18:05 GMT-03:00 Martin Peach <chakekatzil at gmail.com>:

> On Tue, May 8, 2018 at 2:07 PM, Alexandre Torres Porres <porres at gmail.com>
> wrote:
>> ...
>> I personally cannot think of any use case where someone relies on pow(-1,
>> 2) generating "0", it just seems wrong to me (i.e. a bug) and allowing it
>> to do that wouldn't break things.
>> Maybe add another outlet for the imaginary part?

 but simply  pow(-1, 2)  does not generate an imaginary part, right?

well, maybe expanding this to give you complex numbers is stretching a bit.
This only uses the pow function from math.c, but that doesn't give you a
complex number as the result of something like pow(-2, 3.3), it gives you
just 'nan' instead, like what you get from [expr pow(-2, 3.3)]. Making this
an object that outputs a complex number requires more surgery and
expansion, and I don't really know if we need this in the built in object
of [pow], maybe an external?

The question is more of what to do about the inf/nan that comes out, seems
the original and general concern in Pd is to turn them into "0", so I did

And my deep frustration and motivation is simply that I can't do something
like pow(-1, 2) instead of wanting a comex number output... and for that
I'm forced to use [expr] instead, but I just don't see the point.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180508/6cad9ec7/attachment-0001.html>

More information about the Pd-list mailing list