NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.1% → 99.7%
Time: 10.9s
Alternatives: 12
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (/
  (-
   (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x))))
   (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x)))))
  2.0))
double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps):
	return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps)
	return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0)
end
function tmp = code(x, eps)
	tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 73.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (/
  (-
   (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x))))
   (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x)))))
  2.0))
double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps):
	return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps)
	return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0)
end
function tmp = code(x, eps)
	tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}

Alternative 1: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 10^{-40}:\\ \;\;\;\;\frac{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= eps_m 1e-40)
   (/ (* 2.0 (* (exp (- x)) (+ x 1.0))) 2.0)
   (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 1e-40) {
		tmp = (2.0 * (exp(-x) * (x + 1.0))) / 2.0;
	} else {
		tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (eps_m <= 1d-40) then
        tmp = (2.0d0 * (exp(-x) * (x + 1.0d0))) / 2.0d0
    else
        tmp = (exp((x * ((-1.0d0) + eps_m))) + exp((x * -eps_m))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 1e-40) {
		tmp = (2.0 * (Math.exp(-x) * (x + 1.0))) / 2.0;
	} else {
		tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if eps_m <= 1e-40:
		tmp = (2.0 * (math.exp(-x) * (x + 1.0))) / 2.0
	else:
		tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (eps_m <= 1e-40)
		tmp = Float64(Float64(2.0 * Float64(exp(Float64(-x)) * Float64(x + 1.0))) / 2.0);
	else
		tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (eps_m <= 1e-40)
		tmp = (2.0 * (exp(-x) * (x + 1.0))) / 2.0;
	else
		tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1e-40], N[(N[(2.0 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 10^{-40}:\\
\;\;\;\;\frac{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eps < 9.9999999999999993e-41

    1. Initial program 62.7%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified62.7%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 73.1%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg73.1%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg73.1%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg73.1%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out73.1%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity73.1%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in73.1%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval73.1%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out73.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg73.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg73.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in73.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative73.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg73.6%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified73.6%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]

    if 9.9999999999999993e-41 < eps

    1. Initial program 97.4%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified97.4%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around inf 100.0%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    5. Taylor expanded in eps around inf 100.0%

      \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{\left(\varepsilon \cdot x\right)}}}{2} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{\left(x \cdot \varepsilon\right)}}}{2} \]
    7. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\varepsilon \leq 10^{-40}:\\ \;\;\;\;\frac{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 93.1% accurate, 1.1× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 1.26 \cdot 10^{+245}:\\ \;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + eps\_m\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - eps\_m\right)}^{2}\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= eps_m 1.26e+245)
   (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (- x))) 2.0)
   (/
    (+
     2.0
     (*
      x
      (+
       -1.0
       (+ (+ -1.0 eps_m) (* x (+ 0.5 (* 0.5 (pow (- 1.0 eps_m) 2.0))))))))
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 1.26e+245) {
		tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0;
	} else {
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * pow((1.0 - eps_m), 2.0)))))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (eps_m <= 1.26d+245) then
        tmp = (exp((x * ((-1.0d0) + eps_m))) + exp(-x)) / 2.0d0
    else
        tmp = (2.0d0 + (x * ((-1.0d0) + (((-1.0d0) + eps_m) + (x * (0.5d0 + (0.5d0 * ((1.0d0 - eps_m) ** 2.0d0)))))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 1.26e+245) {
		tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp(-x)) / 2.0;
	} else {
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * Math.pow((1.0 - eps_m), 2.0)))))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if eps_m <= 1.26e+245:
		tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp(-x)) / 2.0
	else:
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * math.pow((1.0 - eps_m), 2.0)))))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (eps_m <= 1.26e+245)
		tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(-x))) / 2.0);
	else
		tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(Float64(-1.0 + eps_m) + Float64(x * Float64(0.5 + Float64(0.5 * (Float64(1.0 - eps_m) ^ 2.0)))))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (eps_m <= 1.26e+245)
		tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0;
	else
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * ((1.0 - eps_m) ^ 2.0)))))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.26e+245], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(N[(-1.0 + eps$95$m), $MachinePrecision] + N[(x * N[(0.5 + N[(0.5 * N[Power[N[(1.0 - eps$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.26 \cdot 10^{+245}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + eps\_m\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - eps\_m\right)}^{2}\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eps < 1.2599999999999999e245

    1. Initial program 70.9%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified70.9%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around inf 99.6%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    5. Taylor expanded in eps around 0 89.2%

      \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{x}}}{2} \]
    6. Taylor expanded in eps around -inf 89.2%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 + -1 \cdot \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot x}}}{2} \]
    7. Step-by-step derivation
      1. associate-*r*89.2%

        \[\leadsto \frac{e^{\color{blue}{\left(-1 \cdot x\right) \cdot \left(1 + -1 \cdot \varepsilon\right)}} - -1 \cdot e^{-1 \cdot x}}{2} \]
      2. mul-1-neg89.2%

        \[\leadsto \frac{e^{\color{blue}{\left(-x\right)} \cdot \left(1 + -1 \cdot \varepsilon\right)} - -1 \cdot e^{-1 \cdot x}}{2} \]
      3. mul-1-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \left(1 + \color{blue}{\left(-\varepsilon\right)}\right)} - -1 \cdot e^{-1 \cdot x}}{2} \]
      4. sub-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \color{blue}{\left(1 - \varepsilon\right)}} - -1 \cdot e^{-1 \cdot x}}{2} \]
      5. mul-1-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \color{blue}{\left(-e^{-1 \cdot x}\right)}}{2} \]
      6. mul-1-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{\color{blue}{-x}}\right)}{2} \]
    8. Simplified89.2%

      \[\leadsto \frac{\color{blue}{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-x}\right)}}{2} \]
    9. Taylor expanded in x around inf 89.2%

      \[\leadsto \frac{\color{blue}{e^{-x} + e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)}}}{2} \]
    10. Step-by-step derivation
      1. +-commutative89.2%

        \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} + e^{-x}}}{2} \]
      2. associate-*r*89.2%

        \[\leadsto \frac{e^{\color{blue}{\left(-1 \cdot x\right) \cdot \left(1 - \varepsilon\right)}} + e^{-x}}{2} \]
      3. sub-neg89.2%

        \[\leadsto \frac{e^{\left(-1 \cdot x\right) \cdot \color{blue}{\left(1 + \left(-\varepsilon\right)\right)}} + e^{-x}}{2} \]
      4. mul-1-neg89.2%

        \[\leadsto \frac{e^{\left(-1 \cdot x\right) \cdot \left(1 + \color{blue}{-1 \cdot \varepsilon}\right)} + e^{-x}}{2} \]
      5. associate-*r*89.2%

        \[\leadsto \frac{e^{\color{blue}{-1 \cdot \left(x \cdot \left(1 + -1 \cdot \varepsilon\right)\right)}} + e^{-x}}{2} \]
      6. associate-*r*89.2%

        \[\leadsto \frac{e^{\color{blue}{\left(-1 \cdot x\right) \cdot \left(1 + -1 \cdot \varepsilon\right)}} + e^{-x}}{2} \]
      7. neg-mul-189.2%

        \[\leadsto \frac{e^{\color{blue}{\left(-x\right)} \cdot \left(1 + -1 \cdot \varepsilon\right)} + e^{-x}}{2} \]
      8. mul-1-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \left(1 + \color{blue}{\left(-\varepsilon\right)}\right)} + e^{-x}}{2} \]
      9. sub-neg89.2%

        \[\leadsto \frac{e^{\left(-x\right) \cdot \color{blue}{\left(1 - \varepsilon\right)}} + e^{-x}}{2} \]
    11. Simplified89.2%

      \[\leadsto \frac{\color{blue}{e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} + e^{-x}}}{2} \]

    if 1.2599999999999999e245 < eps

    1. Initial program 100.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around inf 100.0%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    5. Taylor expanded in eps around 0 81.8%

      \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{x}}}{2} \]
    6. Taylor expanded in x around 0 100.0%

      \[\leadsto \frac{\color{blue}{2 + x \cdot \left(\left(-1 \cdot \left(1 - \varepsilon\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - \varepsilon\right)}^{2}\right)\right) - 1\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\varepsilon \leq 1.26 \cdot 10^{+245}:\\ \;\;\;\;\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{-x}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + \varepsilon\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - \varepsilon\right)}^{2}\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.9% accurate, 1.1× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	return (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    code = (exp((x * ((-1.0d0) + eps_m))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	return (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	return (math.exp((x * (-1.0 + eps_m))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps)
function code(x, eps_m)
	return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0)
end
eps_m = abs(eps);
function tmp = code(x, eps_m)
	tmp = (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}
\end{array}
Derivation
  1. Initial program 72.7%

    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
  2. Simplified72.7%

    \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
  3. Add Preprocessing
  4. Taylor expanded in eps around inf 99.6%

    \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
  5. Final simplification99.6%

    \[\leadsto \frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2} \]
  6. Add Preprocessing

Alternative 4: 87.8% accurate, 1.8× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 6.1 \cdot 10^{+54}:\\ \;\;\;\;\frac{2 \cdot e^{-x}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + eps\_m\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - eps\_m\right)}^{2}\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= eps_m 6.1e+54)
   (/ (* 2.0 (exp (- x))) 2.0)
   (/
    (+
     2.0
     (*
      x
      (+
       -1.0
       (+ (+ -1.0 eps_m) (* x (+ 0.5 (* 0.5 (pow (- 1.0 eps_m) 2.0))))))))
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 6.1e+54) {
		tmp = (2.0 * exp(-x)) / 2.0;
	} else {
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * pow((1.0 - eps_m), 2.0)))))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (eps_m <= 6.1d+54) then
        tmp = (2.0d0 * exp(-x)) / 2.0d0
    else
        tmp = (2.0d0 + (x * ((-1.0d0) + (((-1.0d0) + eps_m) + (x * (0.5d0 + (0.5d0 * ((1.0d0 - eps_m) ** 2.0d0)))))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 6.1e+54) {
		tmp = (2.0 * Math.exp(-x)) / 2.0;
	} else {
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * Math.pow((1.0 - eps_m), 2.0)))))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if eps_m <= 6.1e+54:
		tmp = (2.0 * math.exp(-x)) / 2.0
	else:
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * math.pow((1.0 - eps_m), 2.0)))))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (eps_m <= 6.1e+54)
		tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0);
	else
		tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(Float64(-1.0 + eps_m) + Float64(x * Float64(0.5 + Float64(0.5 * (Float64(1.0 - eps_m) ^ 2.0)))))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (eps_m <= 6.1e+54)
		tmp = (2.0 * exp(-x)) / 2.0;
	else
		tmp = (2.0 + (x * (-1.0 + ((-1.0 + eps_m) + (x * (0.5 + (0.5 * ((1.0 - eps_m) ^ 2.0)))))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 6.1e+54], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(N[(-1.0 + eps$95$m), $MachinePrecision] + N[(x * N[(0.5 + N[(0.5 * N[Power[N[(1.0 - eps$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 6.1 \cdot 10^{+54}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + eps\_m\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - eps\_m\right)}^{2}\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eps < 6.0999999999999998e54

    1. Initial program 65.5%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified65.5%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around inf 99.5%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    5. Taylor expanded in eps around 0 89.2%

      \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{x}}}{2} \]
    6. Taylor expanded in eps around 0 83.7%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot x} - -1 \cdot e^{-1 \cdot x}}}{2} \]
    7. Step-by-step derivation
      1. cancel-sign-sub-inv83.7%

        \[\leadsto \frac{\color{blue}{e^{-1 \cdot x} + \left(--1\right) \cdot e^{-1 \cdot x}}}{2} \]
      2. metadata-eval83.7%

        \[\leadsto \frac{e^{-1 \cdot x} + \color{blue}{1} \cdot e^{-1 \cdot x}}{2} \]
      3. distribute-rgt1-in83.7%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot e^{-1 \cdot x}}}{2} \]
      4. metadata-eval83.7%

        \[\leadsto \frac{\color{blue}{2} \cdot e^{-1 \cdot x}}{2} \]
      5. mul-1-neg83.7%

        \[\leadsto \frac{2 \cdot e^{\color{blue}{-x}}}{2} \]
    8. Simplified83.7%

      \[\leadsto \frac{\color{blue}{2 \cdot e^{-x}}}{2} \]

    if 6.0999999999999998e54 < eps

    1. Initial program 100.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around inf 100.0%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    5. Taylor expanded in eps around 0 87.0%

      \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{x}}}{2} \]
    6. Taylor expanded in x around 0 82.8%

      \[\leadsto \frac{\color{blue}{2 + x \cdot \left(\left(-1 \cdot \left(1 - \varepsilon\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - \varepsilon\right)}^{2}\right)\right) - 1\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\varepsilon \leq 6.1 \cdot 10^{+54}:\\ \;\;\;\;\frac{2 \cdot e^{-x}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\left(-1 + \varepsilon\right) + x \cdot \left(0.5 + 0.5 \cdot {\left(1 - \varepsilon\right)}^{2}\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.8% accurate, 2.1× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{2 \cdot e^{-x}}{2} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m) :precision binary64 (/ (* 2.0 (exp (- x))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	return (2.0 * exp(-x)) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    code = (2.0d0 * exp(-x)) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	return (2.0 * Math.exp(-x)) / 2.0;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	return (2.0 * math.exp(-x)) / 2.0
eps_m = abs(eps)
function code(x, eps_m)
	return Float64(Float64(2.0 * exp(Float64(-x))) / 2.0)
end
eps_m = abs(eps);
function tmp = code(x, eps_m)
	tmp = (2.0 * exp(-x)) / 2.0;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\frac{2 \cdot e^{-x}}{2}
\end{array}
Derivation
  1. Initial program 72.7%

    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
  2. Simplified72.7%

    \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
  3. Add Preprocessing
  4. Taylor expanded in eps around inf 99.6%

    \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
  5. Taylor expanded in eps around 0 88.7%

    \[\leadsto \frac{e^{-1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{-1 \cdot \color{blue}{x}}}{2} \]
  6. Taylor expanded in eps around 0 75.4%

    \[\leadsto \frac{\color{blue}{e^{-1 \cdot x} - -1 \cdot e^{-1 \cdot x}}}{2} \]
  7. Step-by-step derivation
    1. cancel-sign-sub-inv75.4%

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot x} + \left(--1\right) \cdot e^{-1 \cdot x}}}{2} \]
    2. metadata-eval75.4%

      \[\leadsto \frac{e^{-1 \cdot x} + \color{blue}{1} \cdot e^{-1 \cdot x}}{2} \]
    3. distribute-rgt1-in75.4%

      \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot e^{-1 \cdot x}}}{2} \]
    4. metadata-eval75.4%

      \[\leadsto \frac{\color{blue}{2} \cdot e^{-1 \cdot x}}{2} \]
    5. mul-1-neg75.4%

      \[\leadsto \frac{2 \cdot e^{\color{blue}{-x}}}{2} \]
  8. Simplified75.4%

    \[\leadsto \frac{\color{blue}{2 \cdot e^{-x}}}{2} \]
  9. Final simplification75.4%

    \[\leadsto \frac{2 \cdot e^{-x}}{2} \]
  10. Add Preprocessing

Alternative 6: 63.3% accurate, 9.5× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -48:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= x -48.0)
   (/
    (* 2.0 (* x (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))
    2.0)
   (/
    (* 2.0 (+ 1.0 (* x (+ 2.0 (* x (+ 1.5 (* x 0.6666666666666666)))))))
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (x <= -48.0) {
		tmp = (2.0 * (x * (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (x <= (-48.0d0)) then
        tmp = (2.0d0 * (x * (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))))) / 2.0d0
    else
        tmp = (2.0d0 * (1.0d0 + (x * (2.0d0 + (x * (1.5d0 + (x * 0.6666666666666666d0))))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (x <= -48.0) {
		tmp = (2.0 * (x * (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if x <= -48.0:
		tmp = (2.0 * (x * (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))) / 2.0
	else:
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (x <= -48.0)
		tmp = Float64(Float64(2.0 * Float64(x * Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))))) / 2.0);
	else
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(2.0 + Float64(x * Float64(1.5 + Float64(x * 0.6666666666666666))))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (x <= -48.0)
		tmp = (2.0 * (x * (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))))) / 2.0;
	else
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[x, -48.0], N[(N[(2.0 * N[(x * N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(1.0 + N[(x * N[(2.0 + N[(x * N[(1.5 + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -48:\\
\;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -48

    1. Initial program 97.7%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified97.7%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 0.0%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg0.0%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg0.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg0.0%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out0.0%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity0.0%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in0.0%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval0.0%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out0.0%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg0.0%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg0.0%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in2.3%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative2.3%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg2.3%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified2.3%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Taylor expanded in x around inf 2.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot e^{-x}\right)}}{2} \]
    8. Step-by-step derivation
      1. exp-neg2.3%

        \[\leadsto \frac{2 \cdot \left(x \cdot \color{blue}{\frac{1}{e^{x}}}\right)}{2} \]
      2. associate-*r/2.3%

        \[\leadsto \frac{2 \cdot \color{blue}{\frac{x \cdot 1}{e^{x}}}}{2} \]
      3. *-rgt-identity2.3%

        \[\leadsto \frac{2 \cdot \frac{\color{blue}{x}}{e^{x}}}{2} \]
    9. Simplified2.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\frac{x}{e^{x}}}}{2} \]
    10. Step-by-step derivation
      1. add-exp-log0.0%

        \[\leadsto \frac{2 \cdot \color{blue}{e^{\log \left(\frac{x}{e^{x}}\right)}}}{2} \]
      2. div-inv0.0%

        \[\leadsto \frac{2 \cdot e^{\log \color{blue}{\left(x \cdot \frac{1}{e^{x}}\right)}}}{2} \]
      3. log-prod0.0%

        \[\leadsto \frac{2 \cdot e^{\color{blue}{\log x + \log \left(\frac{1}{e^{x}}\right)}}}{2} \]
      4. neg-log0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\left(-\log \left(e^{x}\right)\right)}}}{2} \]
      5. add-log-exp0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \left(-\color{blue}{x}\right)}}{2} \]
      6. mul-1-neg0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{-1 \cdot x}}}{2} \]
      7. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{-1 \cdot x} \cdot \sqrt{-1 \cdot x}}}}{2} \]
      8. sqrt-unprod0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{\left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}}}}{2} \]
      9. mul-1-neg0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\color{blue}{\left(-x\right)} \cdot \left(-1 \cdot x\right)}}}{2} \]
      10. mul-1-neg0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\left(-x\right) \cdot \color{blue}{\left(-x\right)}}}}{2} \]
      11. sqr-neg0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\color{blue}{x \cdot x}}}}{2} \]
      12. sqrt-unprod0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}}{2} \]
      13. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{x}}}{2} \]
      14. prod-exp0.0%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{\log x} \cdot e^{x}\right)}}{2} \]
      15. add-exp-log1.5%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{x} \cdot e^{x}\right)}{2} \]
      16. *-commutative1.5%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} \cdot x\right)}}{2} \]
    11. Applied egg-rr1.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} \cdot x\right)}}{2} \]
    12. Taylor expanded in x around 0 82.0%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)\right)\right)}}{2} \]
    13. Step-by-step derivation
      1. *-commutative82.0%

        \[\leadsto \frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + \color{blue}{x \cdot 0.16666666666666666}\right)\right)\right)\right)}{2} \]
    14. Simplified82.0%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\right)\right)}}{2} \]

    if -48 < x

    1. Initial program 67.7%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified67.7%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 71.4%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg71.4%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg71.4%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg71.4%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out71.4%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity71.4%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in71.4%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval71.4%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out71.4%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg71.4%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg71.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in71.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative71.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg71.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified71.4%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative71.4%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in71.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity71.4%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt22.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod64.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg64.4%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod42.1%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt64.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt22.4%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod64.4%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg64.4%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod42.1%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt64.4%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr64.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in64.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative64.4%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified64.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 59.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + 0.6666666666666666 \cdot x\right)\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative59.6%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{x \cdot 0.6666666666666666}\right)\right)\right)}{2} \]
    13. Simplified59.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -48:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 60.1% accurate, 10.3× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+59}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= x 1e+59)
   (/ (* 2.0 (+ 1.0 (* x (* x 1.5)))) 2.0)
   (/
    (* 2.0 (+ 1.0 (* x (+ 2.0 (* x (+ 1.5 (* x 0.6666666666666666)))))))
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (x <= 1e+59) {
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (x <= 1d+59) then
        tmp = (2.0d0 * (1.0d0 + (x * (x * 1.5d0)))) / 2.0d0
    else
        tmp = (2.0d0 * (1.0d0 + (x * (2.0d0 + (x * (1.5d0 + (x * 0.6666666666666666d0))))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (x <= 1e+59) {
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if x <= 1e+59:
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0
	else:
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (x <= 1e+59)
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(x * 1.5)))) / 2.0);
	else
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(2.0 + Float64(x * Float64(1.5 + Float64(x * 0.6666666666666666))))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (x <= 1e+59)
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	else
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[x, 1e+59], N[(N[(2.0 * N[(1.0 + N[(x * N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(1.0 + N[(x * N[(2.0 + N[(x * N[(1.5 + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+59}:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.99999999999999972e58

    1. Initial program 64.9%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified64.9%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 60.1%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg60.1%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out60.1%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity60.1%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in60.1%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval60.1%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in60.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative60.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg60.6%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified60.6%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative60.6%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity60.1%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt24.0%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod56.2%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg56.2%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod32.2%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt56.7%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt24.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod56.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg56.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod32.2%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt56.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr56.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in56.5%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative56.5%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified56.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 66.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + 1.5 \cdot x\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative66.3%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + \color{blue}{x \cdot 1.5}\right)\right)}{2} \]
    13. Simplified66.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot 1.5\right)\right)}}{2} \]
    14. Taylor expanded in x around inf 66.3%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(1.5 \cdot x\right)}\right)}{2} \]
    15. Step-by-step derivation
      1. *-commutative66.3%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]
    16. Simplified66.3%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]

    if 9.99999999999999972e58 < x

    1. Initial program 100.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 56.8%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg56.8%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg56.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg56.8%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out56.8%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity56.8%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in56.8%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval56.8%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out56.8%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg56.8%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg56.8%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified56.8%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative56.8%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity56.8%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod44.7%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg44.7%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod44.7%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt44.7%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod44.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg44.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod44.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt44.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr44.7%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in44.7%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative44.7%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified44.7%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 35.0%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + 0.6666666666666666 \cdot x\right)\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative35.0%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{x \cdot 0.6666666666666666}\right)\right)\right)}{2} \]
    13. Simplified35.0%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 10^{+59}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.2% accurate, 10.3× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 6500:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 - x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= x 6500.0)
   (/ (* 2.0 (+ 1.0 (* x (+ 2.0 (* x (- 1.5 (* x 0.6666666666666666))))))) 2.0)
   (/
    (* 2.0 (+ 1.0 (* x (+ 2.0 (* x (+ 1.5 (* x 0.6666666666666666)))))))
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (x <= 6500.0) {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 - (x * 0.6666666666666666))))))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (x <= 6500.0d0) then
        tmp = (2.0d0 * (1.0d0 + (x * (2.0d0 + (x * (1.5d0 - (x * 0.6666666666666666d0))))))) / 2.0d0
    else
        tmp = (2.0d0 * (1.0d0 + (x * (2.0d0 + (x * (1.5d0 + (x * 0.6666666666666666d0))))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (x <= 6500.0) {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 - (x * 0.6666666666666666))))))) / 2.0;
	} else {
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if x <= 6500.0:
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 - (x * 0.6666666666666666))))))) / 2.0
	else:
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (x <= 6500.0)
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(2.0 + Float64(x * Float64(1.5 - Float64(x * 0.6666666666666666))))))) / 2.0);
	else
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(2.0 + Float64(x * Float64(1.5 + Float64(x * 0.6666666666666666))))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (x <= 6500.0)
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 - (x * 0.6666666666666666))))))) / 2.0;
	else
		tmp = (2.0 * (1.0 + (x * (2.0 + (x * (1.5 + (x * 0.6666666666666666))))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[x, 6500.0], N[(N[(2.0 * N[(1.0 + N[(x * N[(2.0 + N[(x * N[(1.5 - N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(1.0 + N[(x * N[(2.0 + N[(x * N[(1.5 + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6500:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 - x \cdot 0.6666666666666666\right)\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 6500

    1. Initial program 61.7%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified61.7%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 59.1%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg59.1%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg59.1%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg59.1%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out59.1%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity59.1%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in59.1%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval59.1%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out59.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg59.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg59.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in59.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative59.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg59.6%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified59.6%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative59.6%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in59.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity59.1%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt26.2%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod58.6%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg58.6%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod32.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt59.1%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt26.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod59.1%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg59.1%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod32.4%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt58.9%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr58.9%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in58.9%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative58.9%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified58.9%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 58.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + 0.6666666666666666 \cdot x\right)\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative58.6%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{x \cdot 0.6666666666666666}\right)\right)\right)}{2} \]
    13. Simplified58.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}}{2} \]
    14. Step-by-step derivation
      1. add-sqr-sqrt32.4%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot 0.6666666666666666\right)\right)\right)}{2} \]
      2. sqrt-unprod75.4%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{\sqrt{x \cdot x}} \cdot 0.6666666666666666\right)\right)\right)}{2} \]
      3. sqr-neg75.4%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}} \cdot 0.6666666666666666\right)\right)\right)}{2} \]
      4. sqrt-unprod43.0%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot 0.6666666666666666\right)\right)\right)}{2} \]
      5. add-sqr-sqrt75.4%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{\left(-x\right)} \cdot 0.6666666666666666\right)\right)\right)}{2} \]
      6. cancel-sign-sub-inv75.4%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \color{blue}{\left(1.5 - x \cdot 0.6666666666666666\right)}\right)\right)}{2} \]
    15. Applied egg-rr75.4%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \color{blue}{\left(1.5 - x \cdot 0.6666666666666666\right)}\right)\right)}{2} \]

    if 6500 < x

    1. Initial program 100.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 60.1%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg60.1%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out60.1%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity60.1%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in60.1%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval60.1%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg60.1%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified60.1%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative60.1%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity60.1%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod41.5%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg41.5%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod41.5%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt41.5%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod41.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg41.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod41.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt41.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr41.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in41.5%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative41.5%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified41.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 27.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + 0.6666666666666666 \cdot x\right)\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative27.6%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + \color{blue}{x \cdot 0.6666666666666666}\right)\right)\right)}{2} \]
    13. Simplified27.6%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6500:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 - x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(2 + x \cdot \left(1.5 + x \cdot 0.6666666666666666\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 60.1% accurate, 11.3× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 1.35 \cdot 10^{+59}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(-1 + x \cdot 0.5\right)\right)\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= x 1.35e+59)
   (/ (* 2.0 (+ 1.0 (* x (* x 1.5)))) 2.0)
   (/ (* 2.0 (* x (+ 1.0 (* x (+ -1.0 (* x 0.5)))))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (x <= 1.35e+59) {
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	} else {
		tmp = (2.0 * (x * (1.0 + (x * (-1.0 + (x * 0.5)))))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if (x <= 1.35d+59) then
        tmp = (2.0d0 * (1.0d0 + (x * (x * 1.5d0)))) / 2.0d0
    else
        tmp = (2.0d0 * (x * (1.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))))) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if (x <= 1.35e+59) {
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	} else {
		tmp = (2.0 * (x * (1.0 + (x * (-1.0 + (x * 0.5)))))) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if x <= 1.35e+59:
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0
	else:
		tmp = (2.0 * (x * (1.0 + (x * (-1.0 + (x * 0.5)))))) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (x <= 1.35e+59)
		tmp = Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(x * 1.5)))) / 2.0);
	else
		tmp = Float64(Float64(2.0 * Float64(x * Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))))) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (x <= 1.35e+59)
		tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
	else
		tmp = (2.0 * (x * (1.0 + (x * (-1.0 + (x * 0.5)))))) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[x, 1.35e+59], N[(N[(2.0 * N[(1.0 + N[(x * N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x * N[(1.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+59}:\\
\;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(-1 + x \cdot 0.5\right)\right)\right)}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.3500000000000001e59

    1. Initial program 64.9%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified64.9%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 60.1%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg60.1%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg60.1%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out60.1%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity60.1%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in60.1%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval60.1%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg60.1%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in60.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative60.6%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg60.6%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified60.6%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Step-by-step derivation
      1. +-commutative60.6%

        \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
      2. distribute-rgt-in60.1%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
      3. *-un-lft-identity60.1%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
      4. add-sqr-sqrt24.0%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
      5. sqrt-unprod56.2%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
      6. sqr-neg56.2%

        \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
      7. sqrt-unprod32.2%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
      8. add-sqr-sqrt56.7%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
      9. add-sqr-sqrt24.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
      10. sqrt-unprod56.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
      11. sqr-neg56.7%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
      12. sqrt-unprod32.2%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
      13. add-sqr-sqrt56.5%

        \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
    8. Applied egg-rr56.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
    9. Step-by-step derivation
      1. distribute-rgt1-in56.5%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
      2. +-commutative56.5%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
    10. Simplified56.5%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
    11. Taylor expanded in x around 0 66.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + 1.5 \cdot x\right)\right)}}{2} \]
    12. Step-by-step derivation
      1. *-commutative66.3%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + \color{blue}{x \cdot 1.5}\right)\right)}{2} \]
    13. Simplified66.3%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot 1.5\right)\right)}}{2} \]
    14. Taylor expanded in x around inf 66.3%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(1.5 \cdot x\right)}\right)}{2} \]
    15. Step-by-step derivation
      1. *-commutative66.3%

        \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]
    16. Simplified66.3%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]

    if 1.3500000000000001e59 < x

    1. Initial program 100.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 56.8%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg56.8%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg56.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg56.8%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out56.8%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity56.8%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in56.8%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval56.8%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out56.8%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg56.8%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg56.8%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified56.8%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Taylor expanded in x around inf 56.8%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot e^{-x}\right)}}{2} \]
    8. Step-by-step derivation
      1. exp-neg56.8%

        \[\leadsto \frac{2 \cdot \left(x \cdot \color{blue}{\frac{1}{e^{x}}}\right)}{2} \]
      2. associate-*r/56.8%

        \[\leadsto \frac{2 \cdot \color{blue}{\frac{x \cdot 1}{e^{x}}}}{2} \]
      3. *-rgt-identity56.8%

        \[\leadsto \frac{2 \cdot \frac{\color{blue}{x}}{e^{x}}}{2} \]
    9. Simplified56.8%

      \[\leadsto \frac{2 \cdot \color{blue}{\frac{x}{e^{x}}}}{2} \]
    10. Taylor expanded in x around 0 35.0%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot \left(1 + x \cdot \left(0.5 \cdot x - 1\right)\right)\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.35 \cdot 10^{+59}:\\ \;\;\;\;\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(1 + x \cdot \left(-1 + x \cdot 0.5\right)\right)\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 58.1% accurate, 11.9× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -1.6 \lor \neg \left(x \leq 10^{+59}\right):\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(x + 1\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (or (<= x -1.6) (not (<= x 1e+59))) (/ (* 2.0 (* x (+ x 1.0))) 2.0) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((x <= -1.6) || !(x <= 1e+59)) {
		tmp = (2.0 * (x * (x + 1.0))) / 2.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: tmp
    if ((x <= (-1.6d0)) .or. (.not. (x <= 1d+59))) then
        tmp = (2.0d0 * (x * (x + 1.0d0))) / 2.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double tmp;
	if ((x <= -1.6) || !(x <= 1e+59)) {
		tmp = (2.0 * (x * (x + 1.0))) / 2.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if (x <= -1.6) or not (x <= 1e+59):
		tmp = (2.0 * (x * (x + 1.0))) / 2.0
	else:
		tmp = 1.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if ((x <= -1.6) || !(x <= 1e+59))
		tmp = Float64(Float64(2.0 * Float64(x * Float64(x + 1.0))) / 2.0);
	else
		tmp = 1.0;
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if ((x <= -1.6) || ~((x <= 1e+59)))
		tmp = (2.0 * (x * (x + 1.0))) / 2.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[Or[LessEqual[x, -1.6], N[Not[LessEqual[x, 1e+59]], $MachinePrecision]], N[(N[(2.0 * N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \lor \neg \left(x \leq 10^{+59}\right):\\
\;\;\;\;\frac{2 \cdot \left(x \cdot \left(x + 1\right)\right)}{2}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.6000000000000001 or 9.99999999999999972e58 < x

    1. Initial program 99.0%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in eps around 0 32.4%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
    5. Step-by-step derivation
      1. sub-neg32.4%

        \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      2. remove-double-neg32.4%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      3. mul-1-neg32.4%

        \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      4. distribute-lft-out32.4%

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      5. *-lft-identity32.4%

        \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      6. distribute-rgt1-in32.4%

        \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
      7. metadata-eval32.4%

        \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
      8. distribute-lft-out32.4%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
      9. mul-1-neg32.4%

        \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
      10. remove-double-neg32.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
      11. distribute-rgt1-in33.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
      12. *-commutative33.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
      13. mul-1-neg33.4%

        \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
    6. Simplified33.4%

      \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
    7. Taylor expanded in x around inf 33.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot e^{-x}\right)}}{2} \]
    8. Step-by-step derivation
      1. exp-neg33.4%

        \[\leadsto \frac{2 \cdot \left(x \cdot \color{blue}{\frac{1}{e^{x}}}\right)}{2} \]
      2. associate-*r/33.4%

        \[\leadsto \frac{2 \cdot \color{blue}{\frac{x \cdot 1}{e^{x}}}}{2} \]
      3. *-rgt-identity33.4%

        \[\leadsto \frac{2 \cdot \frac{\color{blue}{x}}{e^{x}}}{2} \]
    9. Simplified33.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\frac{x}{e^{x}}}}{2} \]
    10. Step-by-step derivation
      1. add-exp-log32.4%

        \[\leadsto \frac{2 \cdot \color{blue}{e^{\log \left(\frac{x}{e^{x}}\right)}}}{2} \]
      2. div-inv32.4%

        \[\leadsto \frac{2 \cdot e^{\log \color{blue}{\left(x \cdot \frac{1}{e^{x}}\right)}}}{2} \]
      3. log-prod32.4%

        \[\leadsto \frac{2 \cdot e^{\color{blue}{\log x + \log \left(\frac{1}{e^{x}}\right)}}}{2} \]
      4. neg-log32.4%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\left(-\log \left(e^{x}\right)\right)}}}{2} \]
      5. add-log-exp32.4%

        \[\leadsto \frac{2 \cdot e^{\log x + \left(-\color{blue}{x}\right)}}{2} \]
      6. mul-1-neg32.4%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{-1 \cdot x}}}{2} \]
      7. add-sqr-sqrt0.0%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{-1 \cdot x} \cdot \sqrt{-1 \cdot x}}}}{2} \]
      8. sqrt-unprod25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{\left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}}}}{2} \]
      9. mul-1-neg25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\color{blue}{\left(-x\right)} \cdot \left(-1 \cdot x\right)}}}{2} \]
      10. mul-1-neg25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\left(-x\right) \cdot \color{blue}{\left(-x\right)}}}}{2} \]
      11. sqr-neg25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \sqrt{\color{blue}{x \cdot x}}}}{2} \]
      12. sqrt-unprod25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}}{2} \]
      13. add-sqr-sqrt25.5%

        \[\leadsto \frac{2 \cdot e^{\log x + \color{blue}{x}}}{2} \]
      14. prod-exp25.5%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{\log x} \cdot e^{x}\right)}}{2} \]
      15. add-exp-log26.2%

        \[\leadsto \frac{2 \cdot \left(\color{blue}{x} \cdot e^{x}\right)}{2} \]
      16. *-commutative26.2%

        \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} \cdot x\right)}}{2} \]
    11. Applied egg-rr26.2%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} \cdot x\right)}}{2} \]
    12. Taylor expanded in x around 0 40.2%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot \left(1 + x\right)\right)}}{2} \]
    13. Step-by-step derivation
      1. +-commutative40.2%

        \[\leadsto \frac{2 \cdot \left(x \cdot \color{blue}{\left(x + 1\right)}\right)}{2} \]
    14. Simplified40.2%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(x \cdot \left(x + 1\right)\right)}}{2} \]

    if -1.6000000000000001 < x < 9.99999999999999972e58

    1. Initial program 55.9%

      \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
    2. Simplified55.9%

      \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 68.7%

      \[\leadsto \frac{\color{blue}{2}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.6 \lor \neg \left(x \leq 10^{+59}\right):\\ \;\;\;\;\frac{2 \cdot \left(x \cdot \left(x + 1\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 58.1% accurate, 20.6× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m) :precision binary64 (/ (* 2.0 (+ 1.0 (* x (* x 1.5)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	return (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    code = (2.0d0 * (1.0d0 + (x * (x * 1.5d0)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	return (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	return (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0
eps_m = abs(eps)
function code(x, eps_m)
	return Float64(Float64(2.0 * Float64(1.0 + Float64(x * Float64(x * 1.5)))) / 2.0)
end
eps_m = abs(eps);
function tmp = code(x, eps_m)
	tmp = (2.0 * (1.0 + (x * (x * 1.5)))) / 2.0;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := N[(N[(2.0 * N[(1.0 + N[(x * N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
\frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2}
\end{array}
Derivation
  1. Initial program 72.7%

    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
  2. Simplified72.7%

    \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
  3. Add Preprocessing
  4. Taylor expanded in eps around 0 59.4%

    \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) - \left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}}{2} \]
  5. Step-by-step derivation
    1. sub-neg59.4%

      \[\leadsto \frac{\color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
    2. remove-double-neg59.4%

      \[\leadsto \frac{\color{blue}{\left(-\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)\right)} + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
    3. mul-1-neg59.4%

      \[\leadsto \frac{\left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
    4. distribute-lft-out59.4%

      \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)}\right) + \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
    5. *-lft-identity59.4%

      \[\leadsto \frac{\left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right) + \color{blue}{1 \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
    6. distribute-rgt1-in59.4%

      \[\leadsto \frac{\color{blue}{\left(1 + 1\right) \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}}{2} \]
    7. metadata-eval59.4%

      \[\leadsto \frac{\color{blue}{2} \cdot \left(-\left(-1 \cdot e^{-1 \cdot x} + -1 \cdot \left(x \cdot e^{-1 \cdot x}\right)\right)\right)}{2} \]
    8. distribute-lft-out59.4%

      \[\leadsto \frac{2 \cdot \left(-\color{blue}{-1 \cdot \left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}\right)}{2} \]
    9. mul-1-neg59.4%

      \[\leadsto \frac{2 \cdot \left(-\color{blue}{\left(-\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)\right)}\right)}{2} \]
    10. remove-double-neg59.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} + x \cdot e^{-1 \cdot x}\right)}}{2} \]
    11. distribute-rgt1-in59.8%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{-1 \cdot x}\right)}}{2} \]
    12. *-commutative59.8%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{-1 \cdot x} \cdot \left(x + 1\right)\right)}}{2} \]
    13. mul-1-neg59.8%

      \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{-x}} \cdot \left(x + 1\right)\right)}{2} \]
  6. Simplified59.8%

    \[\leadsto \frac{\color{blue}{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}}{2} \]
  7. Step-by-step derivation
    1. +-commutative59.8%

      \[\leadsto \frac{2 \cdot \left(e^{-x} \cdot \color{blue}{\left(1 + x\right)}\right)}{2} \]
    2. distribute-rgt-in59.4%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(1 \cdot e^{-x} + x \cdot e^{-x}\right)}}{2} \]
    3. *-un-lft-identity59.4%

      \[\leadsto \frac{2 \cdot \left(\color{blue}{e^{-x}} + x \cdot e^{-x}\right)}{2} \]
    4. add-sqr-sqrt18.6%

      \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}} + x \cdot e^{-x}\right)}{2} \]
    5. sqrt-unprod53.6%

      \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}} + x \cdot e^{-x}\right)}{2} \]
    6. sqr-neg53.6%

      \[\leadsto \frac{2 \cdot \left(e^{\sqrt{\color{blue}{x \cdot x}}} + x \cdot e^{-x}\right)}{2} \]
    7. sqrt-unprod35.0%

      \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + x \cdot e^{-x}\right)}{2} \]
    8. add-sqr-sqrt54.0%

      \[\leadsto \frac{2 \cdot \left(e^{\color{blue}{x}} + x \cdot e^{-x}\right)}{2} \]
    9. add-sqr-sqrt19.0%

      \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}\right)}{2} \]
    10. sqrt-unprod54.0%

      \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}\right)}{2} \]
    11. sqr-neg54.0%

      \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\sqrt{\color{blue}{x \cdot x}}}\right)}{2} \]
    12. sqrt-unprod35.0%

      \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)}{2} \]
    13. add-sqr-sqrt53.9%

      \[\leadsto \frac{2 \cdot \left(e^{x} + x \cdot e^{\color{blue}{x}}\right)}{2} \]
  8. Applied egg-rr53.9%

    \[\leadsto \frac{2 \cdot \color{blue}{\left(e^{x} + x \cdot e^{x}\right)}}{2} \]
  9. Step-by-step derivation
    1. distribute-rgt1-in53.9%

      \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(x + 1\right) \cdot e^{x}\right)}}{2} \]
    2. +-commutative53.9%

      \[\leadsto \frac{2 \cdot \left(\color{blue}{\left(1 + x\right)} \cdot e^{x}\right)}{2} \]
  10. Simplified53.9%

    \[\leadsto \frac{2 \cdot \color{blue}{\left(\left(1 + x\right) \cdot e^{x}\right)}}{2} \]
  11. Taylor expanded in x around 0 57.5%

    \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + 1.5 \cdot x\right)\right)}}{2} \]
  12. Step-by-step derivation
    1. *-commutative57.5%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(2 + \color{blue}{x \cdot 1.5}\right)\right)}{2} \]
  13. Simplified57.5%

    \[\leadsto \frac{2 \cdot \color{blue}{\left(1 + x \cdot \left(2 + x \cdot 1.5\right)\right)}}{2} \]
  14. Taylor expanded in x around inf 57.5%

    \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(1.5 \cdot x\right)}\right)}{2} \]
  15. Step-by-step derivation
    1. *-commutative57.5%

      \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]
  16. Simplified57.5%

    \[\leadsto \frac{2 \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 1.5\right)}\right)}{2} \]
  17. Final simplification57.5%

    \[\leadsto \frac{2 \cdot \left(1 + x \cdot \left(x \cdot 1.5\right)\right)}{2} \]
  18. Add Preprocessing

Alternative 12: 44.6% accurate, 227.0× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ 1 \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
	return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	return 1.0;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	return 1.0
eps_m = abs(eps)
function code(x, eps_m)
	return 1.0
end
eps_m = abs(eps);
function tmp = code(x, eps_m)
	tmp = 1.0;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|

\\
1
\end{array}
Derivation
  1. Initial program 72.7%

    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
  2. Simplified72.7%

    \[\leadsto \color{blue}{\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(1 - \varepsilon\right) \cdot \left(-x\right)} - \left(\frac{1}{\varepsilon} + -1\right) \cdot e^{\left(1 + \varepsilon\right) \cdot \left(-x\right)}}{2}} \]
  3. Add Preprocessing
  4. Taylor expanded in x around 0 43.0%

    \[\leadsto \frac{\color{blue}{2}}{2} \]
  5. Final simplification43.0%

    \[\leadsto 1 \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024130 
(FPCore (x eps)
  :name "NMSE Section 6.1 mentioned, A"
  :precision binary64
  (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))