Average Error: 0.0 → 0.0
Time: 3.0s
Precision: 64
\[e^{-\left(1 - x \cdot x\right)}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(e^{-\left(1 - x \cdot x\right)}\right)\right)\]
e^{-\left(1 - x \cdot x\right)}
\mathsf{expm1}\left(\mathsf{log1p}\left(e^{-\left(1 - x \cdot x\right)}\right)\right)
double f(double x) {
        double r35426 = 1.0;
        double r35427 = x;
        double r35428 = r35427 * r35427;
        double r35429 = r35426 - r35428;
        double r35430 = -r35429;
        double r35431 = exp(r35430);
        return r35431;
}

double f(double x) {
        double r35432 = 1.0;
        double r35433 = x;
        double r35434 = r35433 * r35433;
        double r35435 = r35432 - r35434;
        double r35436 = -r35435;
        double r35437 = exp(r35436);
        double r35438 = log1p(r35437);
        double r35439 = expm1(r35438);
        return r35439;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[e^{-\left(1 - x \cdot x\right)}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.0

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{-\left(1 - x \cdot x\right)}\right)\right)}\]
  4. Final simplification0.0

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

Reproduce

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