There are 12 messages in this thread.
You are currently looking at messages 1 to .
Is this discussion worth a thumbs up?
Martin Eisenberg wrote: ... > An interesting way to compute arctan has appeared two days ago on > sci.math. But the OP wasn't after speed, and the formula has a whole > bunch of divisions. It is intended for single precision. ... > Robert Israel wrote: > > > It suffices to be able to compute arctan(x) for x in [0,1]. > > Try > > .0318159928972*y+.950551425796+3.86835495723/(y+8.05475522951+ > > 39.4241153441/(y-2.08140771798-.277672591210/(y-8.27402153865+ > > 95.3157060344/(y+10.5910515515)))) > > > > where y = 2*x-1. The maximum error is about 8*10^(-10). That's a minmax rational polynomial approximation for arccos(1/Sqrt(1+x^2)) = arctan(x) for x >= 0 with degree 5 in the numerator and degree 4 in the denominator (just multiply the continued fraction representation out). This uses only one division. The accuracy is a bit high for 32-bit floating-point, a minmax rational polynomial function with degree 4 / degree 2 is enough for that: 0.05030176425872175099 (-6.9888366207752135 + x)(3.14559995508649281e-7 + x)(2.84446368839622429 + 0.826399783297673451 x + x^2) / (1 + 0.1471039133652469065841349249 x + 0.644464067689154755092299698 x^2) The max absolute error in [0,1] is about 3.2e-7 which is still slightly better than 32bit floating-point representation of arctan(x) in [0,1]. Regards, Andor