Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ erfcx()

double stan::math::opencl_kernels::erfcx ( double  x)

Return the scaled complementary error function exp(x * x) * erfc(x) of the kernel generator expression.

Mirrors stan/math/prim/fun/erfcx.hpp branch for branch and formula for formula; the two must be kept in step. The whole positive axis is covered without a library call. On the negative side exp is unavoidable, since erfcx grows like 2*exp(x*x); its argument is corrected with fma, because exp amplifies the rounding of x * x into roughly x * x * eps.

The correction must be written with fma and not with a Dekker split. The split relies on t - (t - x) not being simplified to x, which holds in floating point but not over the reals, and the OpenCL compiler does simplify it: the split form silently degrades to the uncorrected product on device while still being correct on the host. Do not reintroduce it.

Parameters
xargument
Returns
scaled complementary error function of the argument

Definition at line 177 of file erfcx.hpp.