# [PD] Negative input numbers for [pow] return 0

Joe White white.joe4 at gmail.com
Tue Apr 23 11:50:32 CEST 2013

```Disclaimer: I don't feel too strongly about this because I realised my
original calculation was wrong anyway, however...

If you think about it negative exponents require a completely
> different algorithm that is discontinuous with the one for
> positives. Instead of multiplying you divide n times.

exponents are already handled correctly by [pow].

bien sur, it would be easy to add this.
> the thing is, do we really want that?
> having NaN's somewhere in your computation will have all the results
> become NaN, including any signals.
> NaN-signals don't sound good.

There are many things I can do in Pd that don't sound good, I've bust my
ears and headphones/speakers too many times to know that :)
I would argue that yes (I personally) would want that. If the calculation
is wrong, then it's my fault. Also, this is in reference to a message
object that's being
used for a graph calculation. Receiving '0' was confusing.

the output is a number of the value NaN (which gets displayed as NaN, but
> this doesn't mean it a symbol ,just like "1e-8" is not a symbol
> either...usually)

Good to know, thanks!

Out of curiosity, are the workarounds suggested more of a result of the
difficulty of extending the Pd core rather than the implications that such
a change might have? Obviously [expr] is a good solution but still the fact
that [pow] acts differently feels non-intuitive.

Cheers,
Joe

On 22 April 2013 21:43, IOhannes zmölnig <zmoelnig at iem.at> wrote:

> On 04/22/2013 04:07 PM, Joe White wrote:
>
>> Would it be possible
>> to add this to [pow] as well? Something like for negative base values,
>> non-integer exponent values would return NaN?
>>
>
> bien sur, it would be easy to add this.
> the thing is, do we really want that?
> having NaN's somewhere in your computation will have all the results
> become NaN, including any signals.
> NaN-signals don't sound good.
>
>
>
>> Additionally for [pow] to output '0' seems wrong, because that is
>> definitely not the answer. I've never seen NaN output elsewhere so I'm
>> assuming [expr] outputs a symbol and not some Pd defined NaN type
>> (maybe?).
>>
>>  no. the output is a number of the value NaN (which gets displayed as
> NaN, but this doesn't mean it a symbol ,just like "1e-8" is not a symbol
> either...usually)
>
> fmgar
> IOhannes
>
>
> ______________________________**_________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/**
> listinfo/pd-list <http://lists.puredata.info/listinfo/pd-list>
>

--