• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Shared functions for scalar and vector single-precision erfc(x) functions.
3  *
4  * Copyright (c) 2021-2023, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6  */
7 
8 #ifndef PL_MATH_ERFCF_H
9 #define PL_MATH_ERFCF_H
10 
11 #include "math_config.h"
12 
13 #define FMA fma
14 #include "estrin_wrap.h"
15 
16 /* Accurate exponential from optimized-routines.  */
17 double
18 __exp_dd (double x, double xtail);
19 
20 static inline double
eval_poly(double z,const double * coeff)21 eval_poly (double z, const double *coeff)
22 {
23   double z2 = z * z;
24   double z4 = z2 * z2;
25   double z8 = z4 * z4;
26 #define C(i) coeff[i]
27   return ESTRIN_15 (z, z2, z4, z8, C);
28 #undef C
29 }
30 
31 static inline double
eval_exp_mx2(double x)32 eval_exp_mx2 (double x)
33 {
34   return __exp_dd (-(x * x), 0.0);
35 }
36 
37 #undef FMA
38 #endif // PL_MATH_ERFCF_H
39