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.  
  6. /* asin = atan (x / sqrt(1 - x^2)) */
  7.  
  8. float asinf (float x)
  9. {
  10.   float res;
  11.  
  12.   asm ( "fld    %%st\n\t"
  13.         "fmul   %%st(0)\n\t"                    /* x^2 */
  14.         "fld1\n\t"
  15.         "fsubp\n\t"                             /* 1 - x^2 */
  16.         "fsqrt\n\t"                             /* sqrt (1 - x^2) */
  17.         "fpatan"
  18.         : "=t" (res) : "0" (x) : "st(1)");
  19.   return res;
  20. }
  21.  
  22. double asin (double x)
  23. {
  24.   double res;
  25.  
  26.   asm ( "fld    %%st\n\t"
  27.         "fmul   %%st(0)\n\t"                    /* x^2 */
  28.         "fld1\n\t"
  29.         "fsubp\n\t"                             /* 1 - x^2 */
  30.         "fsqrt\n\t"                             /* sqrt (1 - x^2) */
  31.         "fpatan"
  32.         : "=t" (res) : "0" (x) : "st(1)");
  33.   return res;
  34. }
  35.