Hello,
Back to your original question…
This was the fastest (667) execution in my tests for your original request:
float angle = random(0, TAU);
float tmp = cos(angle);
float cosCubed = tmp*tmp*tmp;
Compared to (1127):
float angle = random(0, TAU);
float cosCubed = cos(angle)*cos(angle)*cos(angle);
Slowest (1275) :
float angle = random(0, TAU);
float cosCubed = pow(cos(angle), 3);
The numbers (ms) were the outcome of a stress test using modified code from @jeremydouglass in this topic.
Processing:
cos();
Is a call to Java:
(float) Math.cos(angle);
You can find Processing cos() and pow() here in the source code if you are adventurous to see what it calls from Java:
https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java
Slightly faster if you call the Java Math functions directly.