Average Error: 7.9 → 4.3
Time: 1.4s
Precision: binary64
\[e^{\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s} \le -4.01093996882167036 \cdot 10^{-243}:\\ \;\;\;\;e^{\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s}}\\ \mathbf{else}:\\ \;\;\;\;{\left(e^{u - x}\right)}^{\left(\frac{x - u}{\left(2 \cdot s\right) \cdot s}\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus u

Bits error versus s

Derivation

  1. Split input into 2 regimes
  2. if (/ (* (neg (- x u)) (- x u)) (* (* 2.0 s) s)) < -4.01093996882167036e-243

    1. Initial program 0.0

      \[e^{\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s}}\]

    if -4.01093996882167036e-243 < (/ (* (neg (- x u)) (- x u)) (* (* 2.0 s) s))

    1. Initial program 24.3

      \[e^{\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s}}\]
    2. Simplified13.4

      \[\leadsto \color{blue}{{\left(e^{u - x}\right)}^{\left(\frac{x - u}{\left(2 \cdot s\right) \cdot s}\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s} \le -4.01093996882167036 \cdot 10^{-243}:\\ \;\;\;\;e^{\frac{\left(-\left(x - u\right)\right) \cdot \left(x - u\right)}{\left(2 \cdot s\right) \cdot s}}\\ \mathbf{else}:\\ \;\;\;\;{\left(e^{u - x}\right)}^{\left(\frac{x - u}{\left(2 \cdot s\right) \cdot s}\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020152 
(FPCore (x u s)
  :name "(exp (/ (* (- (- x u)) (- x u)) (* (* 2 s) s)))"
  :precision binary64
  (exp (/ (* (neg (- x u)) (- x u)) (* (* 2.0 s) s))))