[PD] expr "copysign" function doesn't seem to work

Jan Baumgart raga.raga at gmx.de
Sun Jun 7 22:51:24 CEST 2015


You can substitute the copysign function with this ugly thing:

[expr $f1*if($f2==0, 1, $f2/abs($f2))]

cheers,
jan

On 06/07/2015 10:39 PM, Jan Baumgart wrote:
> It's spelled "copysig" in expr.
> But I couldn't get it to work.
>
> copysig in expr only takes one argument, whereas the c math function
> takes two arguments:
> float copysignf(float x, float y);
>
> It returns the absolute value of x with the sign of y.
>
> Smells like a bug to me...
>
> cheers,
> Jan
>
> On 06/07/2015 09:57 PM, Alexandre Torres Porres wrote:
>> hi there, I was checking the source of expr (find it attached) and saw
>> this "copysign" function that I needed for a formula, but I can't get it
>> to work/load.
>>
>> I'm trying something like [expr copysign($f1)] and it's not happening.
>> The expr manual page in http://yadegari.org/expr/expr.html tells about
>> this function as well, here it is:
>>
>> copysign()
>>     1
>>     copy sign of a number(added in version 0.4)
>>
>>
>> So it seems I'm supposedly doing the right thing... is it a bug? I'm on
>> extended 0.42 and it says that it's expr version 0.4 when it loads.
>>
>> cheers
>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>>
>

-- 
Jan Baumgart
Technischer Mitarbeiter
Hochschule für Musik und Darstellende Kunst
Eschersheimer Landstr. 29-39
60322 Frankfurt am Main



More information about the Pd-list mailing list