Where is there a comprehensive list of math functions?
Are there equivalents for these?
- min(x, y) or max(x, y)
- clip(value, min, max), wrap(), fold()
- floor(), ceil(), round()
hjh
List of math ops?
Where is there a comprehensive list of math functions?
Are there equivalents for these?
hjh
@ddw_music Right-click and select help for them........
[int] might be the equivalent of "round"?
David.
Thanks.
[int] seems to be floor() rather than round().
Maybe I'll make an abstraction for 'fold', then.
hjh
@ddw_music + 0.5 then take int is the same as round
You need to scale by power of 10 according to number of decimal points as in the attached
Interestingly it looks like floats get rounded in display to 4 dp anyway ?
Ah right, I forgot about that one because SC has round() built-in. (SC also has the very fine convenience that floor(), ceil(), round() are all binary operators, not unary -- x.round(10) goes to the nearest multiple of 10, instead of forcing you to do round(x * 0.1) * 10.)
'fold' (not parameterized) turned out to be pretty straightforward too.
BTW is there a more idiomatic way to do reciprocals or negation than [expr 1 / $f1]
? I vaguely recall Max has alternate [-] and [/] operators where the left input becomes the second operand.
hjh
You could use the [swap] object.
@Nicolas-Danet "You could use the [swap] object."
A-ha... little by little, these idioms will sink into my skull.
(FWIW, I'm a 17-year user of SuperCollider -- so, WRT to Pd, I know a lot of synthesis and a lot of programming logic already. I can get around in data flows somewhat, but I'm not fluent yet. Catching up though. I found that students in my university struggle with the infamous SC learning curve a bit too much, so that's why I'm looking at Pd for some new courses [plus I need GEM for one of them]. Really appreciate the help here so that I can speak Pd more cleanly.)
hjh
expr~ has functions for floor/ceil/round, check its help file
the else libraries has objects for those as well and also else/wrap2, else/wrap2~, else/fold & else/fold~
Oops! Looks like something went wrong!