ChucK: to and from signed numeric values

In a situation where you want to get the absolute value of a number whether it’s positive or negative. i.e. this is something you might want to do when working with the rate parameter of sndbuf()

just like the abs() functions in  stdlib.h in the C language – strip off it’s sign & return the absolute value:

Std.fabs(float) or Std.abs(int)

these are functions pulled in from ChucKs default libraries.

If you want to do what could be considered the inverse operation involves something more like school maths:

(rate *- rate) => rate;

…will invert a positive value to negative.

Leave a Reply

Your email address will not be published.