1 2/* @(#)e_acos.c 1.3 95/01/18 */ 3/* 4 * ==================================================== 5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 6 * 7 * Developed at SunSoft, a Sun Microsystems, Inc. business. 8 * Permission to use, copy, modify, and distribute this 9 * software is freely granted, provided that this notice 10 * is preserved. 11 * ==================================================== 12 */ 13 14#include <sys/cdefs.h> |
15__FBSDID("$FreeBSD: head/lib/msun/src/e_acos.c 181074 2008-07-31 22:41:26Z das $"); |
16 17/* __ieee754_acos(x) 18 * Method : 19 * acos(x) = pi/2 - asin(x) 20 * acos(-x) = pi/2 + asin(x) 21 * For |x|<=0.5 22 * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) 23 * For x>0.5 --- 9 unchanged lines hidden (view full) --- 33 * 34 * Special cases: 35 * if x is NaN, return x itself; 36 * if |x|>1, return NaN with invalid signal. 37 * 38 * Function needed: sqrt 39 */ 40 |
41#include <float.h> 42 |
43#include "math.h" 44#include "math_private.h" 45 46static const double 47one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ 48pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ 49pio2_hi = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */ 50static volatile double --- 49 unchanged lines hidden (view full) --- 100 c = (z-df*df)/(s+df); 101 p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); 102 q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); 103 r = p/q; 104 w = r*s+c; 105 return 2.0*(df+w); 106 } 107} |
108 109#if LDBL_MANT_DIG == 53 110__weak_reference(acos, acosl); 111#endif |