Average Error: 0.0 → 0.0
Time: 2.8s
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 r28731 = 1.0;
        double r28732 = x;
        double r28733 = r28732 * r28732;
        double r28734 = r28731 - r28733;
        double r28735 = -r28734;
        double r28736 = exp(r28735);
        return r28736;
}

double f(double x) {
        double r28737 = exp(1.0);
        double r28738 = 1.0;
        double r28739 = x;
        double r28740 = r28739 * r28739;
        double r28741 = r28738 - r28740;
        double r28742 = exp(r28741);
        double r28743 = log(r28742);
        double r28744 = -r28743;
        double r28745 = pow(r28737, r28744);
        return r28745;
}

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)))))