There are indeed some complex things going on with this test.
For example, this takes 138 us:
for (int i = 0; i < 3; i++)
{
sinanswers[i] = sin(i);
}
time2 = micros();
But this takes takes 229 us.... almost twice as long, just because the input is offset by 400. Clearly sin()'s execution time is not constant.
for (int i = 0; i < 3; i++)
{
sinanswers[i] = sin(i+400);
}
time2 = micros();
I suspected the slowness was due to computing double precision. But I tried changing sin() to sinf(), and amazingly sinf() takes MUCH longer. Clearly newlib or libgcc is not optimized very well, or some settings aren't quite right. I need to dig into that......