libc-top-half/musl/src/math/i386/acos.s
raw| 1 | # use acos(x) = atan2(fabs(sqrt((1-x)*(1+x))), x) |
| 2 | |
| 3 | .global acos |
| 4 | .type acos,@function |
| 5 | acos: |
| 6 | fldl 4(%esp) |
| 7 | fld %st(0) |
| 8 | fld1 |
| 9 | fsub %st(0),%st(1) |
| 10 | fadd %st(2) |
| 11 | fmulp |
| 12 | fsqrt |
| 13 | fabs # fix sign of zero (matters in downward rounding mode) |
| 14 | fxch %st(1) |
| 15 | fpatan |
| 16 | fstpl 4(%esp) |
| 17 | fldl 4(%esp) |
| 18 | ret |