Be careful using that code as a test; a good optimizing compiler could pick up 
that sin is a library function without side effects, and no result is saved, 
and optimize that loop to two calls to adjustValueRadians. 

Sandy

On Aug 8, 2013, at 8:17 PM, Thomas Wetmore <[email protected]> wrote:

> David,
> 
> Those are lightening speeds. So I agree with you wholeheartedly -- there is 
> no sense in working on a custom table-driven approach. The current approach 
> must already be table-based with speeds like that.
> 
> Tom Wetmore
> 
> 
> On Aug 8, 2013, at 1:26 PM, David Rowland <[email protected]> wrote:
> 
>> I wrote an app that calculates the positions of Sun and Moon and other 
>> information as well. The heart of the Moon calculation is this. I added a 
>> loop around it and called a stopwatch at the beginning and end.
>> 
>>  startTime();
>>  for (int jj = 0; jj<100;++jj)
>>  {
>>  //in radians
>>  double lambda = 3.81040282295402 + 8399.70910754626 * T
>>  + 0.109781209950443 * sin(adjustValueRadians(2.35619449019234 + 
>> 8328.69146829639 * T))
>>  - 0.022165681500328 * sin(adjustValueRadians(4.5256387504213 - 
>> 7214.06294691607 * T))
>> 
>> One hundred times through this loop, on my iPhone 5, took about 0.0028 
>> seconds. Two hundred times took about 0.0056 sec.
>> 
>> I infer that one pass takes about 0.000028 seconds, or 28.0 microseconds.
>> 
>> The functions are probably very carefully written and could not be improved 
>> by table lookups, vector libraries, etc. That is barking up the wrong tree. 
>> 
>> David
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mcguffogl%40gmail.com
> 
> This email sent to [email protected]


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to