LCOV - code coverage report
Current view: top level - src - e_acosl.c (source / functions) Coverage Total Hit
Test: app.info Lines: 0.0 % 35 0
Test Date: 2024-01-11 15:52:50 Functions: 0.0 % 1 0
Branches: 0.0 % 14 0

             Branch data     Line data    Source code
       1                 :             : 
       2                 :             : /* @(#)e_acos.c 1.3 95/01/18 */
       3                 :             : /* FreeBSD: head/lib/msun/src/e_acos.c 176451 2008-02-22 02:30:36Z das */
       4                 :             : /*
       5                 :             :  * ====================================================
       6                 :             :  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
       7                 :             :  *
       8                 :             :  * Developed at SunSoft, a Sun Microsystems, Inc. business.
       9                 :             :  * Permission to use, copy, modify, and distribute this
      10                 :             :  * software is freely granted, provided that this notice 
      11                 :             :  * is preserved.
      12                 :             :  * ====================================================
      13                 :             :  */
      14                 :             : 
      15                 :             : #include "cdefs-compat.h"
      16                 :             : //__FBSDID("$FreeBSD: src/lib/msun/src/e_acosl.c,v 1.2 2008/08/02 03:56:22 das Exp $");
      17                 :             : 
      18                 :             : /*
      19                 :             :  * See comments in e_acos.c.
      20                 :             :  * Converted to long double by David Schultz <das@FreeBSD.ORG>.
      21                 :             :  */
      22                 :             : 
      23                 :             : #include <float.h>
      24                 :             : #include <openlibm_math.h>
      25                 :             : 
      26                 :             : #include "invtrig.h"
      27                 :             : #include "math_private.h"
      28                 :             : 
      29                 :             : static const long double
      30                 :             : one=  1.00000000000000000000e+00;
      31                 :             : 
      32                 :             : #ifdef __i386__
      33                 :             : /* XXX Work around the fact that gcc truncates long double constants on i386 */
      34                 :             : static volatile double
      35                 :             : pi1 =  3.14159265358979311600e+00,      /*  0x1.921fb54442d18p+1  */
      36                 :             : pi2 =  1.22514845490862001043e-16;      /*  0x1.1a80000000000p-53 */
      37                 :             : #define pi      ((long double)pi1 + pi2)
      38                 :             : #else
      39                 :             : static const long double
      40                 :             : pi =  3.14159265358979323846264338327950280e+00L;
      41                 :             : #endif
      42                 :             : 
      43                 :             : OLM_DLLEXPORT long double
      44                 :           0 : acosl(long double x)
      45                 :             : {
      46                 :             :         union IEEEl2bits u;
      47                 :             :         long double z,p,q,r,w,s,c,df;
      48                 :             :         int16_t expsign, expt;
      49                 :           0 :         u.e = x;
      50                 :           0 :         expsign = u.xbits.expsign;
      51                 :           0 :         expt = expsign & 0x7fff;
      52         [ #  # ]:           0 :         if(expt >= BIAS) {   /* |x| >= 1 */
      53   [ #  #  #  # ]:           0 :             if(expt==BIAS && ((u.bits.manh&~LDBL_NBIT)|u.bits.manl)==0) {
      54         [ #  # ]:           0 :                 if (expsign>0) return 0.0;   /* acos(1) = 0  */
      55                 :           0 :                 else return pi+2.0*pio2_lo;     /* acos(-1)= pi */
      56                 :             :             }
      57                 :           0 :             return (x-x)/(x-x);         /* acos(|x|>1) is NaN */
      58                 :             :         }
      59         [ #  # ]:           0 :         if(expt<BIAS-1) {    /* |x| < 0.5 */
      60         [ #  # ]:           0 :             if(expt<ACOS_CONST) return pio2_hi+pio2_lo;/*x tiny: acosl=pi/2*/
      61                 :           0 :             z = x*x;
      62                 :           0 :             p = P(z);
      63                 :           0 :             q = Q(z);
      64                 :           0 :             r = p/q;
      65                 :           0 :             return pio2_hi - (x - (pio2_lo-x*r));
      66         [ #  # ]:           0 :         } else  if (expsign<0) {     /* x < -0.5 */
      67                 :           0 :             z = (one+x)*0.5;
      68                 :           0 :             p = P(z);
      69                 :           0 :             q = Q(z);
      70                 :           0 :             s = sqrtl(z);
      71                 :           0 :             r = p/q;
      72                 :           0 :             w = r*s-pio2_lo;
      73                 :           0 :             return pi - 2.0*(s+w);
      74                 :             :         } else {                        /* x > 0.5 */
      75                 :           0 :             z = (one-x)*0.5;
      76                 :           0 :             s = sqrtl(z);
      77                 :           0 :             u.e = s;
      78                 :           0 :             u.bits.manl = 0;
      79                 :           0 :             df = u.e;
      80                 :           0 :             c  = (z-df*df)/(s+df);
      81                 :           0 :             p = P(z);
      82                 :           0 :             q = Q(z);
      83                 :           0 :             r = p/q;
      84                 :           0 :             w = r*s+c;
      85                 :           0 :             return 2.0*(df+w);
      86                 :             :         }
      87                 :             : }
        

Generated by: LCOV version 2.0-115.g950771e