Hi all -
I’m struggling a little bit to wrap my head around the mathematical precedence in SuperCollider. I’m in the midst of trying to translate a large chunk of JavaScript code and it is getting very tangled up in the syntax.
My preferred question is: is there a simple function that can reformat the order-of-operations from one language to another?
The more involved question would be: can anyone suggest a way to get more comfortable with the order-of-operations in SC? I remember PEMDAS from grade school - can I just SAD MEP?

Hi @josh -
It never bothered me before - but now that I’m trying to translate from JavaScript into SC, I’m finding it quite difficult to put the parens in the right place…

For instance, this is a line of code that I’m translating:

(
var sinm = 2;
var t = 0.1;
var sin2m = 3;
var sin3m = 4;
(sinm * (1.914602 - t * (0.004817 + 0.000014 * t))) + (sin2m * (0.019993 - 0.000101 * t)) + (sin3m * 0.000289);
)

returns 0.0088768684524.

Whereas, in Javascript:

{
var sinm = 2;
var t = 0.1;
var sin2m = 3;
var sin3m = 4;
print(sinm * (1.914602 - t * (0.004817 + 0.000014 * t)) + sin2m * (0.019993 - 0.000101 * t) + sin3m * 0.000289);
}

returns: 3.88934502

Maybe there’s something methodical and obvious about this to the more mathematically-inclined SC users - but I’d definitely appreciate some advice about how to break this down more.