aboutsummaryrefslogtreecommitdiff
path: root/pl/math/erfcf.h
blob: 8f1e5f4226e3bc66a9ad0097c3af338a7486efa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Shared functions for scalar and vector single-precision erfc(x) functions.
 *
 * Copyright (c) 2021-2023, Arm Limited.
 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
 */

#ifndef PL_MATH_ERFCF_H
#define PL_MATH_ERFCF_H

#include "math_config.h"

#define FMA fma
#include "estrin_wrap.h"

/* Accurate exponential from optimized-routines.  */
double
__exp_dd (double x, double xtail);

static inline double
eval_poly (double z, const double *coeff)
{
  double z2 = z * z;
  double z4 = z2 * z2;
  double z8 = z4 * z4;
#define C(i) coeff[i]
  return ESTRIN_15 (z, z2, z4, z8, C);
#undef C
}

static inline double
eval_exp_mx2 (double x)
{
  return __exp_dd (-(x * x), 0.0);
}

#undef FMA
#endif // PL_MATH_ERFCF_H