I'm doing alot of maths based calculations, ie using sin,cos and atan2
Some for these are in loops i.e.
Code: Select all
for( i=0; i<360; i++ )
{
// calculate pitch
z2 = ( -x * sin( rads(i) )) + ( z * cos( rads(i) ));
for( j=0; j<360; j++ )
{
// calculate roll
z3 = ( y * sin( rads(j) )) + ( z2 * cos( rads( j ) ));
ori.sortField = ( z3 + ( i * 0.0056f ));
if( ori.sortField > ori.finalSortField )
{
ori.p1 = i;
ori.r1 = j;
ori.finalSortField = ori.sortField;
}
}
}
When the FPU = no in makefile the processing time for thing is quite long, i.e. 9 seconds or so.
If i enable FPU = hard, this makes no difference to the length of time........
Is there other things i need to look at ? All my data types in the code are floats, but the math.h lib are in doubles. Ive read that doubles are still handle in software, thus this would explain why......
So is there away to force to use floats for doubles and thus allow the FPU to process everything ? PS other option might be to use sinf, cosf and atan2f....