<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Off on a tangent : a look at arctangent implementations</title>
	<atom:link href="http://www.coranac.com/documents/arctangent/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coranac.com</link>
	<description>my own little world</description>
	<lastBuildDate>Fri, 23 Dec 2011 16:50:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: John</title>
		<link>http://www.coranac.com/documents/arctangent/comment-page-1/#comment-3063</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 16 Apr 2010 08:18:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.coranac.com/?page_id=64#comment-3063</guid>
		<description>Regarding the atanTonc constants. The following constants were published in a book. They provide 1/4 of the error, at values close to 1, than the ones you derived. Your ones were OK for the fixed point precision you had. But for floating point the extra precision at no cost is welcome.&lt;p&gt;
0.9998660&lt;p&gt;
0.3302995&lt;p&gt;
0.1801410&lt;p&gt;
0.0851330&lt;p&gt;
0.0208351&lt;p&gt;
P.S. Thanks for the great articles. I have just found your website today and am reading like crazy. I have already speed up a Sin approximation I was using.</description>
		<content:encoded><![CDATA[<p>Regarding the atanTonc constants. The following constants were published in a book. They provide 1/4 of the error, at values close to 1, than the ones you derived. Your ones were OK for the fixed point precision you had. But for floating point the extra precision at no cost is welcome.
<p>
 0.9998660</p>
<p>
 0.3302995</p>
<p>
 0.1801410</p>
<p>
 0.0851330</p>
<p>
 0.0208351</p>
<p>
 P.S. Thanks for the great articles. I have just found your website today and am reading like crazy. I have already speed up a Sin approximation I was using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salviati</title>
		<link>http://www.coranac.com/documents/arctangent/comment-page-1/#comment-2115</link>
		<dc:creator>salviati</dc:creator>
		<pubDate>Mon, 23 Mar 2009 23:04:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.coranac.com/?page_id=64#comment-2115</guid>
		<description>The basic idea is to get the approximant agree with the function (conveniently, with it&#039;s Taylor expansion) at all derivatives. I don&#039;t know how Mathematica actually handles it, but I&#039;m pretty sure it has a pretty cool way to do it fast. There&#039;s an actual implementation, however, in Numerical Recipes in C, chapter 5.12.

Floats? Why can&#039;t you do them with fixed point math?
Cool! Indeed,  one mul can be converted to a bitshift+addition :) Would you care to benchmark an actual implementation --it might turn out to be OK.
BTW, I see one more benefit in this 2nd order expansion, atan2 (which would be 3y/(3x+y&lt;sup&gt;2&lt;/sup&gt;/x)) should introduce less rounding errors, while keeping the number of div/mul operations same.</description>
		<content:encoded><![CDATA[<p>The basic idea is to get the approximant agree with the function (conveniently, with it&#8217;s Taylor expansion) at all derivatives. I don&#8217;t know how Mathematica actually handles it, but I&#8217;m pretty sure it has a pretty cool way to do it fast. There&#8217;s an actual implementation, however, in Numerical Recipes in C, chapter 5.12.</p>
<p> Floats? Why can&#8217;t you do them with fixed point math?<br />
 Cool! Indeed,  one mul can be converted to a bitshift+addition :) Would you care to benchmark an actual implementation &#8211;it might turn out to be OK.<br />
 BTW, I see one more benefit in this 2nd order expansion, atan2 (which would be 3y/(3x+y<sup>2</sup>/x)) should introduce less rounding errors, while keeping the number of div/mul operations same.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cearn</title>
		<link>http://www.coranac.com/documents/arctangent/comment-page-1/#comment-2114</link>
		<dc:creator>cearn</dc:creator>
		<pubDate>Fri, 20 Mar 2009 13:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.coranac.com/?page_id=64#comment-2114</guid>
		<description>No I hadn&#039;t considered Pad&#232; approximants, but only because I wasn&#039;t aware of their existence. They do look interesting, but I think the extra div may cost too much here compared to other methods. Also note that the methods you&#039;ve described here all use floats. Transforming to integer-only math is possible, but will affect the accuracy as well. x/(1+x&#178;/3) only uses a single mul, as it can be converted into 3x/(3+x&#178;).

I&#039;ve looked in my books to see a few words about Pad&#232;, but it was rather sketchy on how to calculate the coefficients. Do yo uknow how Mathematica does it?</description>
		<content:encoded><![CDATA[<p>No I hadn&#8217;t considered Pad&egrave; approximants, but only because I wasn&#8217;t aware of their existence. They do look interesting, but I think the extra div may cost too much here compared to other methods. Also note that the methods you&#8217;ve described here all use floats. Transforming to integer-only math is possible, but will affect the accuracy as well. x/(1+x&sup2;/3) only uses a single mul, as it can be converted into 3x/(3+x&sup2;).</p>
<p> I&#8217;ve looked in my books to see a few words about Pad&egrave;, but it was rather sketchy on how to calculate the coefficients. Do yo uknow how Mathematica does it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salviati</title>
		<link>http://www.coranac.com/documents/arctangent/comment-page-1/#comment-2113</link>
		<dc:creator>salviati</dc:creator>
		<pubDate>Wed, 18 Mar 2009 18:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.coranac.com/?page_id=64#comment-2113</guid>
		<description>By the way, if you can live with a minor discontinuity in your atan, you can patch together various Pade approximants centered differently, all of order (2,2). For instance, you can use zero-centered approximant x/(1+x^2/3) for x&lt;0.23 and 0.5 centered approximant
(0.463648 + 1.17092(-0.5 + x) + 0.493095 (-0.5 + x)^2) / (1.0000000000000000 + 0.8(-0.5 + x) + 0.373333(-0.5 + x)^2) which comes with slight overhead (5 mul, 1 div whereas the previous one was 2 mul, 1 div). Note that 0.493095 can be approximated to 1/2, reducing a multiplication to bitshift.

With this, your worst error is 0.03%. But of course, a discontinuity in the function at x=0.23 comes along with the ride (which is ~1.3e-4; actual value of atan(0.23) is ~0.227 so the discontinuity is 0.05% of the value there). The point ~0.23 was to minimize the maximum error, but you can choose another value to minimize discontinuity. If this bothers you, you can reduce this amount by patching 3 (or even more) Pade approximants.</description>
		<content:encoded><![CDATA[<p>By the way, if you can live with a minor discontinuity in your atan, you can patch together various Pade approximants centered differently, all of order (2,2). For instance, you can use zero-centered approximant x/(1+x^2/3) for x&lt;0.23 and 0.5 centered approximant<br />
 (0.463648 + 1.17092(-0.5 + x) + 0.493095 (-0.5 + x)^2) / (1.0000000000000000 + 0.8(-0.5 + x) + 0.373333(-0.5 + x)^2) which comes with slight overhead (5 mul, 1 div whereas the previous one was 2 mul, 1 div). Note that 0.493095 can be approximated to 1/2, reducing a multiplication to bitshift.</p>
<p> With this, your worst error is 0.03%. But of course, a discontinuity in the function at x=0.23 comes along with the ride (which is ~1.3e-4; actual value of atan(0.23) is ~0.227 so the discontinuity is 0.05% of the value there). The point ~0.23 was to minimize the maximum error, but you can choose another value to minimize discontinuity. If this bothers you, you can reduce this amount by patching 3 (or even more) Pade approximants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salviati</title>
		<link>http://www.coranac.com/documents/arctangent/comment-page-1/#comment-2112</link>
		<dc:creator>salviati</dc:creator>
		<pubDate>Wed, 18 Mar 2009 03:07:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.coranac.com/?page_id=64#comment-2112</guid>
		<description>Have you ever considered a Pade approximant ---it is used widely in practice. Mathematica has a nice function for calculation any order of Pade approximants, here&#039;s what I get for a (2,2) order expansion

atan[x_] = PadeApproximant[ArcTan[x], {x, 0, {2, 2}}]

x/(1+x^2/3)

In involves a division and a multiplication, aside from division by 3, which, for fixed point arithmetic, is a multiplication by a constant anyways.
The accuracy of the (2,2) expansion in the first octant is 2.1% in the worst case (whereas 7th order Taylor expansion is %0.65)

Plot[100 (atan[x] - ArcTan[x])/ArcTan[x], {x, 0, Pi/4}]

Here&#039;s the plot http://img18.imageshack.us/my.php?image=atanpade22.jpg

A higher order expansion yields (x + 4x^3)/(1 + 3x^2/5) which yields %0.25 at worst, but it seems quite costy.</description>
		<content:encoded><![CDATA[<p>Have you ever considered a Pade approximant &#8212;it is used widely in practice. Mathematica has a nice function for calculation any order of Pade approximants, here&#8217;s what I get for a (2,2) order expansion</p>
<p> atan[x_] = PadeApproximant[ArcTan[x], {x, 0, {2, 2}}]</p>
<p> x/(1+x^2/3)</p>
<p> In involves a division and a multiplication, aside from division by 3, which, for fixed point arithmetic, is a multiplication by a constant anyways.<br />
 The accuracy of the (2,2) expansion in the first octant is 2.1% in the worst case (whereas 7th order Taylor expansion is %0.65)</p>
<p> Plot[100 (atan[x] &#8211; ArcTan[x])/ArcTan[x], {x, 0, Pi/4}]</p>
<p> Here&#8217;s the plot <a href="http://img18.imageshack.us/my.php?image=atanpade22.jpg" rel="nofollow">http://img18.imageshack.us/my.php?image=atanpade22.jpg</a></p>
<p> A higher order expansion yields (x + 4x^3)/(1 + 3x^2/5) which yields %0.25 at worst, but it seems quite costy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!--
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
</head>
<body>
<p>
My database has called in sick. Please imagine some 
annoying elevator tune till he gets back.
</p>
<p>
<small>[[Doo-di-doo tooo. Dum-di-dum-di-doo-dooo.]]</small>
</p>
</body>
</html>

-->
