Average Error: 0.0 → 0.0
Time: 2.5s
Precision: 64
\[e^{-\left(1 - x \cdot x\right)}\]
\[{e}^{\left(-\log \left(e^{1 - x \cdot x}\right)\right)}\]
e^{-\left(1 - x \cdot x\right)}
{e}^{\left(-\log \left(e^{1 - x \cdot x}\right)\right)}
double f(double x) {
        double r25530 = 1.0;
        double r25531 = x;
        double r25532 = r25531 * r25531;
        double r25533 = r25530 - r25532;
        double r25534 = -r25533;
        double r25535 = exp(r25534);
        return r25535;
}

double f(double x) {
        double r25536 = exp(1.0);
        double r25537 = 1.0;
        double r25538 = x;
        double r25539 = r25538 * r25538;
        double r25540 = r25537 - r25539;
        double r25541 = exp(r25540);
        double r25542 = log(r25541);
        double r25543 = -r25542;
        double r25544 = pow(r25536, r25543);
        return r25544;
}

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 *-un-lft-identity0.0

    \[\leadsto e^{\color{blue}{1 \cdot \left(-\left(1 - x \cdot x\right)\right)}}\]
  4. Applied exp-prod0.0

    \[\leadsto \color{blue}{{\left(e^{1}\right)}^{\left(-\left(1 - x \cdot x\right)\right)}}\]
  5. Simplified0.0

    \[\leadsto {\color{blue}{e}}^{\left(-\left(1 - x \cdot x\right)\right)}\]
  6. Using strategy rm
  7. Applied add-log-exp0.0

    \[\leadsto {e}^{\left(-\left(1 - \color{blue}{\log \left(e^{x \cdot x}\right)}\right)\right)}\]
  8. Applied add-log-exp0.0

    \[\leadsto {e}^{\left(-\left(\color{blue}{\log \left(e^{1}\right)} - \log \left(e^{x \cdot x}\right)\right)\right)}\]
  9. Applied diff-log0.0

    \[\leadsto {e}^{\left(-\color{blue}{\log \left(\frac{e^{1}}{e^{x \cdot x}}\right)}\right)}\]
  10. Simplified0.0

    \[\leadsto {e}^{\left(-\log \color{blue}{\left(e^{1 - x \cdot x}\right)}\right)}\]
  11. Final simplification0.0

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

Reproduce

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