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

Alexandre Torres Porres porres at gmail.com
Mon Jun 8 08:45:19 CEST 2015


Hello, great to hear from you. Yes, I got that fix, but I never compiled it
and was just hoping someday it'd show up as an update, and I'm just worried
it never came to be. Sorry to put you on the spot. I'm still learning about
the bug reports work and get dealt with in Pd, people in the list were
explaining to me today in fact. But since everyone is gathered here,
instead of me making a bug report, I'll just post everything I found wrong
or funny. I spent a great deal of time testing, here we go:

- the help file of [expr] gives the wrong link to expr documentation, it
points to http://www.crca.ucsd.edu/~yadegari/expr.html where it should
point to the new link http://yadegari.org/expr/expr.html

- The random function is not listed in the documentation link above. But
it's great and I always use it. It has a bug in Pd extended 0.42 where
[expr random(1000, 100001)] will eventually give negative numbers. But,
somehow, this seems to be fixed in vanilla 0.46-6.

- the "if" function is mentioned twice in the documentation

- The function "Sum" is not working yet.

- In the code we see other functions for tables that are not mentioned on
the
documentation link They are: "avg", "Avg" and "Store" - but none of which
seem to be working as well!

- there's this "copysig" issue (which is written wrong int the
documentation as "copysign") and it seems to not be working.

- expr will consider integers as integers, so [expr 5 / 4] results in "1".
You can do something like [expr 5./ 4] for it to work, or use the float
function like this:  [expr float(5) / 4]. Now, this may not be a bug or
wrong, but if you use [expr float(1.4)] it'll return you "1" instead of
"1.4", and I guess it should be "1.4" anyway...

- [expr imodf($f1)] and [expr ldexp($f1)] are not loading

- [expr drem($f1)] loads with one argument, but the documentation says it
takes two arguments. Even though it loads, it doesn't seem to be working,
it sends lots of errors, such as "error: expr: FUNC_EVAL(1291): bad right
type 0 /// expr: bang: unrecognized result 0 /// error: expr:
FUNC_EVAL(1291): bad right type 3

- One's comlpement will load like this [expr $f1 ~ $f2]. Not sure what it's
supposed to be, but it seems the second argument doesn't affect it at all.

- "floor" and "ceil" will load with two arguments, documentation says it
was only one! Not sure what they're supposed to be, but it doesn't seem
right cause it always returns the 1st argument in both of them.

- "fmod", wrong number of arguments in the documentation, it takes two!

- In the documentation, you have "
atan()
1
inverse hyperbolic tangent"
but I belive it should be "atan*h*"

- Code says

 *      The following are done but not popular enough in math libss
 *      to be included yet
 *              hypoth - Euclidean distance function
 *              trunc
 *              round
 *              nearbyint -


So, maybe they are popular enough nowadays? Maybe they're ready to be
included?

Well, that's what I found so far. I'm no mathematician, so I can't find
anything else I guess. I could test other functions but I wouldn't know if
they are correct.

Anyway, sorry I can't help more getting into the code issues. I'm at a
point now that I wish I know more about programming so I can help Pd
development.

Thanks



2015-06-08 3:08 GMT-03:00 Shahrokh Yadegari <sdy at ucsd.edu>:

> Hi Alexandre,
>
> This seems to be a bug. I am not sure why I missed the 'n' on the name
> either. As it seems that this function has never worked, we should fix the
> name as well. The solution is simple as follows:
>
> extra/expr~/vexp_fun.c
>
> 188c188
>
> <         {"copysign",    ex_copysign,    2},
>
> ---
>
> >         {"copysig",     ex_copysign,    1},
>
>
> I checked the mailing list (I am sorry that I am not a regular reader) and
> I see some concerns about the maintenance of the code. I am happy to fix
> the problems and I thought I sent you a fix for the last problem you had
> found in 2009. Can somebody point me to a document or a webpage that
> explains what the best way is to introduce new changes to the pd source
> base.  Miller, should I pass the fixes to you, or is there another
> repository?
>
> In the meanwhile, if there are other bugs in expr that anybody else knows,
> please send them to me and I will fix them as soon as I can.
>
> best,
> Shahrokh
>
> On Sun, Jun 7, 2015 at 12:57 PM, Alexandre Torres Porres <porres at gmail.com
> > 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
>>
>
>
>
> --
> Shahrokh Yadegari
> Professor of Composition and Sound Design,
> Theatre and Dance Department
> University of California, San Diego
> Director, Initiative for Digital Exploration of Arts and Science, (IDEAS)
> California Institute for Telecommunications and Information Technologies
> (Calit2)
> Email: sdy at ucsd.edu
> Web: http://yadegari.org
> Tel: (858) 822-4113
> Fax: (858) 534-1080
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150608/e8fe0bc1/attachment-0001.html>


More information about the Pd-list mailing list