Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast atan2



On Jan 24, 2005, at 1:02 AM, Robert Purves wrote:

double fast_atan2(double y, double x)
<snip>
Shaun Wexler

Blindingly fast! The maximum absolute error (>0.07 radians) is, alas, much too big for my application.


Here's another answer to my question, based on a 50-year old atan approximation due to Hastings. It has |error| < 0.005, and (with all relevant optimizations in gcc) is 3-5x faster than atan2 in spite of two horrible divisions in the main code path.

I wrote my own AltiVec function which computes normalized phase (atan2/pi) and did determine my own coefficients for Ar3-Br-C, which results in a maximum error of 0.1539% (0.00483 rads), so I guess that's at least as good as any of the other fast estimate methods... ;)
--
Shaun Wexler
MacFOH
http://www.macfoh.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Fast atan2 (From: Robert Purves <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.