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

Alexandre Torres Porres porres at gmail.com
Wed May 9 04:36:13 CEST 2018

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

> I think pow(-1, 0.5) should give a 'NaN' instead of 0 if we're sticking to
> Real numbers.

I don't mind the nan/inf output either, but it's not up to me... I'm just
guessing there's such a concern in avoiding them, as with [log]/[log~], or
even when you do [/ 0]! The fact is that Pd internal math objects have this
thing already, you know, and it's not like preventing negative numbers was
some accident, it was quite intentional, so I'm trying to meet half way
instead of just proposing we should change everything and just deal with

> I'm not sure if something like [select NaN Inf -Inf] works in Pd. It
> doesn't give any error on creation but how to generate the input?

It doesn't work, I tried with [expr pow(-1, 0.5)], which generates nan in
this case... by the way, I guess if people care about nans, then they can
just adopt the expr version. The expr object, while we're at it, allows you
to check if a number is a nan or inf with the isnan($f1) / isinf($f1)
functions - then you can feed it to a select object. So you have this
situation already in Pd with expr that better deals with this kind of math
already, which is a poin that maybe we shouldn't mess too much with
[pow]/[pow~] apart from letting them compute negative numbers that make
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180508/3e5c9500/attachment.html>

More information about the Pd-list mailing list