Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Written by J.T. Conklin <jtc@netbsd.org>.
  3.  * Public domain.
  4.  *
  5.  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
  6.  */
  7.  
  8. #include <math.h>
  9.  
  10. long double
  11. acosl (long double x)
  12. {
  13.   long double res;
  14.  
  15.   /* acosl = atanl (sqrtl(1 - x^2) / x) */
  16.   asm ( "fld    %%st\n\t"
  17.         "fmul   %%st(0)\n\t"            /* x^2 */
  18.         "fld1\n\t"
  19.         "fsubp\n\t"                     /* 1 - x^2 */
  20.         "fsqrt\n\t"                     /* sqrtl (1 - x^2) */
  21.         "fxch   %%st(1)\n\t"
  22.         "fpatan"
  23.         : "=t" (res) : "0" (x) : "st(1)");
  24.   return res;
  25. }
  26.