about summary refs log tree commit diff
path: root/src/math/i386/acos.s
Commit message (Collapse)AuthorAgeFilesLines
* math: change the formula used for acos.snsz2012-05-051-10/+8
| | | | | | | | | | old: 2*atan2(sqrt(1-x),sqrt(1+x)) new: atan2(fabs(sqrt((1-x)*(1+x))),x) improvements: * all edge cases are fixed (sign of zero in downward rounding) * a bit faster (here a single call is about 131ns vs 162ns) * a bit more precise (at most 1ulp error on 1M uniform random samples in [0,1), the old formula gave some 2ulp errors as well)
* acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))nsz2012-03-221-3/+1
| | | | | | | the old formula atan2(1,sqrt((1+x)/(1-x))) was faster but could give nan result at x=1 when the rounding mode is FE_DOWNWARD (so 1-1 == -0 and 2/-0 == -inf), the new formula gives -0 at x=+-1 with downward rounding.
* use alternate formula for acos asm to avoid loss of precisionRich Felker2012-03-191-3/+11
|
* asm for inverse trig functionsRich Felker2012-03-191-0/+24
unlike trig functions, these are easy to do in asm because they do not involve (arbitrary-precision) argument reduction. fpatan automatically takes care of domain issues, and in asin and acos, fsqrt takes care of them for us.