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

IOhannes m zmoelnig zmoelnig at iem.at
Mon Apr 22 14:30:43 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-04-22 14:19, Joe White wrote:
> Hi,
> 
> Just realised putting a negative number into the [pow] object
> outputs '0'?!?
> 
> For example if I do:
> 
> [-1 ( | [pow 2]
> 
> it returns 0, where I would expect it to return 1.
> 
> Is this a known limitation or bug?

it's most likely a feature that tries to protect you from things like:

[-1(
|
[pow 0.5]
|

> Are there any work arounds if I want a variable power?

urgh, i had hoped to never have to tell people to use [expr], but
there you go:

[-1\
|
[pack 0 2]
|
[expr pow($f1, $f2)]
|
[1\

vbmdf
IOhannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlF1LW8ACgkQkX2Xpv6ydvRWDgCffaIHH1qXGqFYLlt1iiJQFW5Q
OdEAnR8WVw+zxRKd8LWjVo95daJ/Aq6Y
=PbB6
-----END PGP SIGNATURE-----



More information about the Pd-list mailing list