Average Error: 0.0 → 0.2
Time: 17.3s
Precision: 64
\[e^{-\left(1 - x \cdot x\right)}\]
\[\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(e^{\mathsf{fma}\left(x, x, -1\right)}\right)\right)\right)\right)\]
e^{-\left(1 - x \cdot x\right)}
\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(e^{\mathsf{fma}\left(x, x, -1\right)}\right)\right)\right)\right)
double f(double x) {
        double r1433873 = 1.0;
        double r1433874 = x;
        double r1433875 = r1433874 * r1433874;
        double r1433876 = r1433873 - r1433875;
        double r1433877 = -r1433876;
        double r1433878 = exp(r1433877);
        return r1433878;
}

double f(double x) {
        double r1433879 = x;
        double r1433880 = -1.0;
        double r1433881 = fma(r1433879, r1433879, r1433880);
        double r1433882 = exp(r1433881);
        double r1433883 = expm1(r1433882);
        double r1433884 = log1p(r1433883);
        return r1433884;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[e^{-\left(1 - x \cdot x\right)}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(x, x, -1\right)}}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u0.2

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(e^{\mathsf{fma}\left(x, x, -1\right)}\right)\right)\right)\right)}\]
  5. Final simplification0.2

    \[\leadsto \mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(e^{\mathsf{fma}\left(x, x, -1\right)}\right)\right)\right)\right)\]

Reproduce

herbie shell --seed 2019130 +o rules:numerics
(FPCore (x)
  :name "exp neg sub"
  (exp (- (- 1 (* x x)))))