• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 /*
7  * Written by J.T. Conklin <jtc@netbsd.org>.
8  * Public domain.
9  */
10 
11 #include <math.h>
12 
13 float
acosf(float x)14 acosf (float x)
15 {
16   float res = 0.0F;
17 
18   /* acosl = atanl (sqrtl(1 - x^2) / x) */
19   asm volatile (
20 	"fld	%%st\n\t"
21 	"fmul	%%st(0)\n\t"		/* x^2 */
22 	"fld1\n\t"
23 	"fsubp\n\t"			/* 1 - x^2 */
24 	"fsqrt\n\t"			/* sqrtl (1 - x^2) */
25 	"fxch	%%st(1)\n\t"
26 	"fpatan"
27 	: "=t" (res) : "0" (x) : "st(1)");
28   return res;
29 }
30