[PD] pow with negative numbers

Alexandros Drymonitis adrcki at gmail.com
Sat Jun 6 19:13:43 CEST 2015


On Sat, Jun 6, 2015 at 7:44 PM, Max <abonnements at revolwear.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm trying to get [pow 2] from -0.019022952498528478.
> because it is negative, [pow 2] will just return 0 unfortunately.
> IOhannes suggested in a thread from 2013 to use
> [expr pow($f1, 2)] instead.
> This returns 0.000361872
>
> however, in Python and my on-screen pocket calculator I get
> - -0.019022952498528478**2
> - -0.0003618727217612709
>
> so apart from the 32 bit float, shouldn't the result be negative?
>
As far as the math is concerned, when you multiply two negative numbers,
you get a positive, right? why expect a negative then? Maybe I'm missing
something obvious here, dunno...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150606/502d02a1/attachment.html>


More information about the Pd-list mailing list