Average Error: 0.0 → 0.0
Time: 2.4s
Precision: 64
\[e^{-\left(1 - x \cdot x\right)}\]
\[\frac{\frac{1}{e^{1 - {x}^{2}}}}{e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}\]
e^{-\left(1 - x \cdot x\right)}
\frac{\frac{1}{e^{1 - {x}^{2}}}}{e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}
double code(double x) {
	return exp(-(1.0 - (x * x)));
}
double code(double x) {
	return ((1.0 / exp((1.0 - pow(x, 2.0)))) / exp(fma(-x, x, (x * x))));
}

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 exp-neg0.0

    \[\leadsto \color{blue}{\frac{1}{e^{1 - x \cdot x}}}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.0

    \[\leadsto \frac{1}{e^{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - x \cdot x}}\]
  6. Applied prod-diff0.0

    \[\leadsto \frac{1}{e^{\color{blue}{\mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -x \cdot x\right) + \mathsf{fma}\left(-x, x, x \cdot x\right)}}}\]
  7. Applied exp-sum0.0

    \[\leadsto \frac{1}{\color{blue}{e^{\mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -x \cdot x\right)} \cdot e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}}\]
  8. Applied associate-/r*0.0

    \[\leadsto \color{blue}{\frac{\frac{1}{e^{\mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -x \cdot x\right)}}}{e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}}\]
  9. Simplified0.0

    \[\leadsto \frac{\color{blue}{\frac{1}{e^{1 - {x}^{2}}}}}{e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}\]
  10. Final simplification0.0

    \[\leadsto \frac{\frac{1}{e^{1 - {x}^{2}}}}{e^{\mathsf{fma}\left(-x, x, x \cdot x\right)}}\]

Reproduce

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