Quotient of sum of exps

Percentage Accurate: 98.8% → 100.0%
Time: 6.6s
Alternatives: 9
Speedup: 2.9×

Specification

?
\[\begin{array}{l} \\ \frac{e^{a}}{e^{a} + e^{b}} \end{array} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e^{a}}{e^{a} + e^{b}}
\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 9 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: 98.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{e^{a}}{e^{a} + e^{b}} \end{array} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}

Alternative 1: 100.0% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + e^{b - a}} \end{array} \]
(FPCore (a b) :precision binary64 (/ 1.0 (+ 1.0 (exp (- b a)))))
double code(double a, double b) {
	return 1.0 / (1.0 + exp((b - a)));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = 1.0d0 / (1.0d0 + exp((b - a)))
end function
public static double code(double a, double b) {
	return 1.0 / (1.0 + Math.exp((b - a)));
}
def code(a, b):
	return 1.0 / (1.0 + math.exp((b - a)))
function code(a, b)
	return Float64(1.0 / Float64(1.0 + exp(Float64(b - a))))
end
function tmp = code(a, b)
	tmp = 1.0 / (1.0 + exp((b - a)));
end
code[a_, b_] := N[(1.0 / N[(1.0 + N[Exp[N[(b - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{1 + e^{b - a}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{e^{a}}{e^{a} + e^{b}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube99.0%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
    2. pow1/399.6%

      \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
    3. pow399.6%

      \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
    4. clear-num99.6%

      \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
    5. inv-pow99.6%

      \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
    6. pow-pow99.6%

      \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
    7. metadata-eval99.6%

      \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
  5. Step-by-step derivation
    1. unpow1/399.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
    2. +-commutative99.0%

      \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
  6. Simplified99.0%

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
  7. Step-by-step derivation
    1. expm1-log1p-u99.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
    2. expm1-udef99.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
    3. pow1/399.5%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
    4. pow-pow99.5%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
    5. metadata-eval99.5%

      \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
  8. Applied egg-rr99.5%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
  9. Step-by-step derivation
    1. expm1-def99.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
    2. expm1-log1p99.6%

      \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
    3. unpow-199.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
    4. rem-exp-log99.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
    5. exp-diff100.0%

      \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
    6. sub-neg100.0%

      \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
    7. prod-exp99.6%

      \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
    8. rem-exp-log99.6%

      \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
    9. *-commutative99.6%

      \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
    10. +-commutative99.6%

      \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
    11. distribute-lft-in77.3%

      \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
    12. rec-exp77.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
    13. lft-mult-inverse99.6%

      \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
    14. prod-exp100.0%

      \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
  10. Simplified100.0%

    \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
  11. Final simplification100.0%

    \[\leadsto \frac{1}{1 + e^{b - a}} \]
  12. Add Preprocessing

Alternative 2: 98.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{1 + e^{-a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -5.8e-15) (/ 1.0 (+ 1.0 (exp (- a)))) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
	double tmp;
	if (a <= -5.8e-15) {
		tmp = 1.0 / (1.0 + exp(-a));
	} else {
		tmp = 1.0 / (1.0 + exp(b));
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-5.8d-15)) then
        tmp = 1.0d0 / (1.0d0 + exp(-a))
    else
        tmp = 1.0d0 / (1.0d0 + exp(b))
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (a <= -5.8e-15) {
		tmp = 1.0 / (1.0 + Math.exp(-a));
	} else {
		tmp = 1.0 / (1.0 + Math.exp(b));
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -5.8e-15:
		tmp = 1.0 / (1.0 + math.exp(-a))
	else:
		tmp = 1.0 / (1.0 + math.exp(b))
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -5.8e-15)
		tmp = Float64(1.0 / Float64(1.0 + exp(Float64(-a))));
	else
		tmp = Float64(1.0 / Float64(1.0 + exp(b)));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -5.8e-15)
		tmp = 1.0 / (1.0 + exp(-a));
	else
		tmp = 1.0 / (1.0 + exp(b));
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -5.8e-15], N[(1.0 / N[(1.0 + N[Exp[(-a)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{1 + e^{-a}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.80000000000000037e-15

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube99.9%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/399.9%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow3100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num99.9%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow99.9%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow99.9%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval99.9%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/399.9%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative99.9%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified99.9%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u99.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef99.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/399.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow99.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval99.9%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr99.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def99.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p99.9%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-199.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log99.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in5.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp5.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse100.0%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 100.0%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]

    if -5.80000000000000037e-15 < a

    1. Initial program 99.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 98.9%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{1 + e^{-a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -720:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -720.0) 0.0 (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
	double tmp;
	if (a <= -720.0) {
		tmp = 0.0;
	} else {
		tmp = 1.0 / (1.0 + exp(b));
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-720.0d0)) then
        tmp = 0.0d0
    else
        tmp = 1.0d0 / (1.0d0 + exp(b))
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (a <= -720.0) {
		tmp = 0.0;
	} else {
		tmp = 1.0 / (1.0 + Math.exp(b));
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -720.0:
		tmp = 0.0
	else:
		tmp = 1.0 / (1.0 + math.exp(b))
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -720.0)
		tmp = 0.0;
	else
		tmp = Float64(1.0 / Float64(1.0 + exp(b)));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -720.0)
		tmp = 0.0;
	else
		tmp = 1.0 / (1.0 + exp(b));
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -720.0], 0.0, N[(1.0 / N[(1.0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -720:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\


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

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube100.0%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/3100.0%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow3100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num100.0%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow100.0%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval100.0%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/3100.0%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative100.0%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef100.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/3100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval100.0%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log100.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in0.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp0.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse100.0%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 100.0%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{0} \]

    if -720 < a

    1. Initial program 99.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 98.4%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -720:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.7% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{e^{a}}{a + 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -5.8e-15) (/ (exp a) (+ a 2.0)) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
	double tmp;
	if (a <= -5.8e-15) {
		tmp = exp(a) / (a + 2.0);
	} else {
		tmp = 1.0 / (1.0 + exp(b));
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-5.8d-15)) then
        tmp = exp(a) / (a + 2.0d0)
    else
        tmp = 1.0d0 / (1.0d0 + exp(b))
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (a <= -5.8e-15) {
		tmp = Math.exp(a) / (a + 2.0);
	} else {
		tmp = 1.0 / (1.0 + Math.exp(b));
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= -5.8e-15:
		tmp = math.exp(a) / (a + 2.0)
	else:
		tmp = 1.0 / (1.0 + math.exp(b))
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= -5.8e-15)
		tmp = Float64(exp(a) / Float64(a + 2.0));
	else
		tmp = Float64(1.0 / Float64(1.0 + exp(b)));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= -5.8e-15)
		tmp = exp(a) / (a + 2.0);
	else
		tmp = 1.0 / (1.0 + exp(b));
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, -5.8e-15], N[(N[Exp[a], $MachinePrecision] / N[(a + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{e^{a}}{a + 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.80000000000000037e-15

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\frac{e^{a}}{1 + e^{a}}} \]
    4. Taylor expanded in a around 0 99.5%

      \[\leadsto \frac{e^{a}}{\color{blue}{2 + a}} \]
    5. Step-by-step derivation
      1. +-commutative99.5%

        \[\leadsto \frac{e^{a}}{\color{blue}{a + 2}} \]
    6. Simplified99.5%

      \[\leadsto \frac{e^{a}}{\color{blue}{a + 2}} \]

    if -5.80000000000000037e-15 < a

    1. Initial program 99.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 98.9%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{e^{a}}{a + 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{b}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.6% accurate, 20.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.05:\\ \;\;\;\;1\\ \mathbf{elif}\;b \leq 1.4:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= b -1.05) 1.0 (if (<= b 1.4) (+ 0.5 (* a 0.25)) 0.0)))
double code(double a, double b) {
	double tmp;
	if (b <= -1.05) {
		tmp = 1.0;
	} else if (b <= 1.4) {
		tmp = 0.5 + (a * 0.25);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-1.05d0)) then
        tmp = 1.0d0
    else if (b <= 1.4d0) then
        tmp = 0.5d0 + (a * 0.25d0)
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (b <= -1.05) {
		tmp = 1.0;
	} else if (b <= 1.4) {
		tmp = 0.5 + (a * 0.25);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if b <= -1.05:
		tmp = 1.0
	elif b <= 1.4:
		tmp = 0.5 + (a * 0.25)
	else:
		tmp = 0.0
	return tmp
function code(a, b)
	tmp = 0.0
	if (b <= -1.05)
		tmp = 1.0;
	elseif (b <= 1.4)
		tmp = Float64(0.5 + Float64(a * 0.25));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (b <= -1.05)
		tmp = 1.0;
	elseif (b <= 1.4)
		tmp = 0.5 + (a * 0.25);
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[b, -1.05], 1.0, If[LessEqual[b, 1.4], N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.05:\\
\;\;\;\;1\\

\mathbf{elif}\;b \leq 1.4:\\
\;\;\;\;0.5 + a \cdot 0.25\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.05000000000000004

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube100.0%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/3100.0%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow3100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num100.0%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow100.0%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval100.0%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/3100.0%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative100.0%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef100.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/3100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval100.0%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log100.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse100.0%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 18.8%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{1} \]

    if -1.05000000000000004 < b < 1.3999999999999999

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in b around 0 98.9%

      \[\leadsto \color{blue}{\frac{e^{a}}{1 + e^{a}}} \]
    4. Taylor expanded in a around 0 69.7%

      \[\leadsto \color{blue}{0.5 + 0.25 \cdot a} \]
    5. Step-by-step derivation
      1. *-commutative69.7%

        \[\leadsto 0.5 + \color{blue}{a \cdot 0.25} \]
    6. Simplified69.7%

      \[\leadsto \color{blue}{0.5 + a \cdot 0.25} \]

    if 1.3999999999999999 < b

    1. Initial program 98.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube98.5%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/398.5%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow398.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num98.5%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow98.5%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow98.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval98.5%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr98.5%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/398.5%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative98.5%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified98.5%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef98.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/398.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow98.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval98.5%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr98.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-198.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log98.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log98.5%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative98.5%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in75.4%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp75.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse98.5%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 25.5%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.05:\\ \;\;\;\;1\\ \mathbf{elif}\;b \leq 1.4:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.3% accurate, 27.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.1:\\ \;\;\;\;1\\ \mathbf{elif}\;b \leq 1.75:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= b -1.1) 1.0 (if (<= b 1.75) 0.5 0.0)))
double code(double a, double b) {
	double tmp;
	if (b <= -1.1) {
		tmp = 1.0;
	} else if (b <= 1.75) {
		tmp = 0.5;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-1.1d0)) then
        tmp = 1.0d0
    else if (b <= 1.75d0) then
        tmp = 0.5d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (b <= -1.1) {
		tmp = 1.0;
	} else if (b <= 1.75) {
		tmp = 0.5;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if b <= -1.1:
		tmp = 1.0
	elif b <= 1.75:
		tmp = 0.5
	else:
		tmp = 0.0
	return tmp
function code(a, b)
	tmp = 0.0
	if (b <= -1.1)
		tmp = 1.0;
	elseif (b <= 1.75)
		tmp = 0.5;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (b <= -1.1)
		tmp = 1.0;
	elseif (b <= 1.75)
		tmp = 0.5;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[b, -1.1], 1.0, If[LessEqual[b, 1.75], 0.5, 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1:\\
\;\;\;\;1\\

\mathbf{elif}\;b \leq 1.75:\\
\;\;\;\;0.5\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.1000000000000001

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube100.0%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/3100.0%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow3100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num100.0%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow100.0%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval100.0%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/3100.0%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative100.0%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef100.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/3100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval100.0%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log100.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse100.0%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 18.8%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{1} \]

    if -1.1000000000000001 < b < 1.75

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 69.8%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
    4. Taylor expanded in b around 0 68.7%

      \[\leadsto \color{blue}{0.5} \]

    if 1.75 < b

    1. Initial program 98.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube98.5%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/398.5%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow398.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num98.5%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow98.5%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow98.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval98.5%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr98.5%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/398.5%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative98.5%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified98.5%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef98.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/398.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow98.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval98.5%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr98.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-198.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log98.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log98.5%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative98.5%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in75.4%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp75.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse98.5%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 25.5%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.1:\\ \;\;\;\;1\\ \mathbf{elif}\;b \leq 1.75:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 48.7% accurate, 50.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.4 \cdot 10^{-15}:\\ \;\;\;\;0.16666666666666666\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b) :precision binary64 (if (<= b -3.4e-15) 0.16666666666666666 0.0))
double code(double a, double b) {
	double tmp;
	if (b <= -3.4e-15) {
		tmp = 0.16666666666666666;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-3.4d-15)) then
        tmp = 0.16666666666666666d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (b <= -3.4e-15) {
		tmp = 0.16666666666666666;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if b <= -3.4e-15:
		tmp = 0.16666666666666666
	else:
		tmp = 0.0
	return tmp
function code(a, b)
	tmp = 0.0
	if (b <= -3.4e-15)
		tmp = 0.16666666666666666;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (b <= -3.4e-15)
		tmp = 0.16666666666666666;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[b, -3.4e-15], 0.16666666666666666, 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.4 \cdot 10^{-15}:\\
\;\;\;\;0.16666666666666666\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -3.4e-15

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube99.9%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/3100.0%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow3100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num100.0%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow100.0%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow100.0%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval100.0%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/399.9%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative99.9%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified99.9%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u99.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef100.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/3100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow100.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval100.0%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log100.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative100.0%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse100.0%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 22.3%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr16.6%

      \[\leadsto \color{blue}{0.16666666666666666} \]

    if -3.4e-15 < b

    1. Initial program 99.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube98.8%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/399.5%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow399.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num99.5%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow99.5%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow99.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval99.5%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr99.5%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/398.8%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative98.8%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified98.8%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u98.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef99.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/399.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow99.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval99.4%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr99.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def99.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p99.5%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-199.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log99.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp99.5%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log99.5%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative99.5%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative99.5%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in72.0%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp72.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse99.5%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 76.2%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr53.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.4 \cdot 10^{-15}:\\ \;\;\;\;0.16666666666666666\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.2% accurate, 50.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.05:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b) :precision binary64 (if (<= b 2.05) 0.5 0.0))
double code(double a, double b) {
	double tmp;
	if (b <= 2.05) {
		tmp = 0.5;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= 2.05d0) then
        tmp = 0.5d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (b <= 2.05) {
		tmp = 0.5;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if b <= 2.05:
		tmp = 0.5
	else:
		tmp = 0.0
	return tmp
function code(a, b)
	tmp = 0.0
	if (b <= 2.05)
		tmp = 0.5;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (b <= 2.05)
		tmp = 0.5;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[b, 2.05], 0.5, 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.05:\\
\;\;\;\;0.5\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.0499999999999998

    1. Initial program 100.0%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 77.1%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{b}}} \]
    4. Taylor expanded in b around 0 56.7%

      \[\leadsto \color{blue}{0.5} \]

    if 2.0499999999999998 < b

    1. Initial program 98.5%

      \[\frac{e^{a}}{e^{a} + e^{b}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube98.5%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
      2. pow1/398.5%

        \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
      3. pow398.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
      4. clear-num98.5%

        \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
      5. inv-pow98.5%

        \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
      6. pow-pow98.5%

        \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
      7. metadata-eval98.5%

        \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
    4. Applied egg-rr98.5%

      \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
    5. Step-by-step derivation
      1. unpow1/398.5%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
      2. +-commutative98.5%

        \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
    6. Simplified98.5%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
      2. expm1-udef98.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
      3. pow1/398.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
      4. pow-pow98.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
      5. metadata-eval98.5%

        \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
    8. Applied egg-rr98.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
      3. unpow-198.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
      4. rem-exp-log98.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
      5. exp-diff100.0%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
      6. sub-neg100.0%

        \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
      7. prod-exp98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
      8. rem-exp-log98.5%

        \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
      9. *-commutative98.5%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
      10. +-commutative98.5%

        \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
      11. distribute-lft-in75.4%

        \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
      12. rec-exp75.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
      13. lft-mult-inverse98.5%

        \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
      14. prod-exp100.0%

        \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
    11. Taylor expanded in b around 0 25.5%

      \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
    12. Applied egg-rr100.0%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.05:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 46.6% accurate, 305.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (a b) :precision binary64 0.0)
double code(double a, double b) {
	return 0.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = 0.0d0
end function
public static double code(double a, double b) {
	return 0.0;
}
def code(a, b):
	return 0.0
function code(a, b)
	return 0.0
end
function tmp = code(a, b)
	tmp = 0.0;
end
code[a_, b_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{e^{a}}{e^{a} + e^{b}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube99.0%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}}} \]
    2. pow1/399.6%

      \[\leadsto \color{blue}{{\left(\left(\frac{e^{a}}{e^{a} + e^{b}} \cdot \frac{e^{a}}{e^{a} + e^{b}}\right) \cdot \frac{e^{a}}{e^{a} + e^{b}}\right)}^{0.3333333333333333}} \]
    3. pow399.6%

      \[\leadsto {\color{blue}{\left({\left(\frac{e^{a}}{e^{a} + e^{b}}\right)}^{3}\right)}}^{0.3333333333333333} \]
    4. clear-num99.6%

      \[\leadsto {\left({\color{blue}{\left(\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}\right)}}^{3}\right)}^{0.3333333333333333} \]
    5. inv-pow99.6%

      \[\leadsto {\left({\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-1}\right)}}^{3}\right)}^{0.3333333333333333} \]
    6. pow-pow99.6%

      \[\leadsto {\color{blue}{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\left(-1 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
    7. metadata-eval99.6%

      \[\leadsto {\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{\color{blue}{-3}}\right)}^{0.3333333333333333} \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{{\left({\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}} \]
  5. Step-by-step derivation
    1. unpow1/399.0%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{a} + e^{b}}{e^{a}}\right)}^{-3}}} \]
    2. +-commutative99.0%

      \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{e^{b} + e^{a}}}{e^{a}}\right)}^{-3}} \]
  6. Simplified99.0%

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}} \]
  7. Step-by-step derivation
    1. expm1-log1p-u99.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)\right)} \]
    2. expm1-udef99.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt[3]{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}}\right)} - 1} \]
    3. pow1/399.5%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-3}\right)}^{0.3333333333333333}}\right)} - 1 \]
    4. pow-pow99.5%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\left(-3 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
    5. metadata-eval99.5%

      \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{\color{blue}{-1}}\right)} - 1 \]
  8. Applied egg-rr99.5%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)} - 1} \]
  9. Step-by-step derivation
    1. expm1-def99.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}\right)\right)} \]
    2. expm1-log1p99.6%

      \[\leadsto \color{blue}{{\left(\frac{e^{b} + e^{a}}{e^{a}}\right)}^{-1}} \]
    3. unpow-199.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{b} + e^{a}}{e^{a}}}} \]
    4. rem-exp-log99.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)}}}{e^{a}}} \]
    5. exp-diff100.0%

      \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right) - a}}} \]
    6. sub-neg100.0%

      \[\leadsto \frac{1}{e^{\color{blue}{\log \left(e^{b} + e^{a}\right) + \left(-a\right)}}} \]
    7. prod-exp99.6%

      \[\leadsto \frac{1}{\color{blue}{e^{\log \left(e^{b} + e^{a}\right)} \cdot e^{-a}}} \]
    8. rem-exp-log99.6%

      \[\leadsto \frac{1}{\color{blue}{\left(e^{b} + e^{a}\right)} \cdot e^{-a}} \]
    9. *-commutative99.6%

      \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot \left(e^{b} + e^{a}\right)}} \]
    10. +-commutative99.6%

      \[\leadsto \frac{1}{e^{-a} \cdot \color{blue}{\left(e^{a} + e^{b}\right)}} \]
    11. distribute-lft-in77.3%

      \[\leadsto \frac{1}{\color{blue}{e^{-a} \cdot e^{a} + e^{-a} \cdot e^{b}}} \]
    12. rec-exp77.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{e^{a}}} \cdot e^{a} + e^{-a} \cdot e^{b}} \]
    13. lft-mult-inverse99.6%

      \[\leadsto \frac{1}{\color{blue}{1} + e^{-a} \cdot e^{b}} \]
    14. prod-exp100.0%

      \[\leadsto \frac{1}{1 + \color{blue}{e^{\left(-a\right) + b}}} \]
  10. Simplified100.0%

    \[\leadsto \color{blue}{\frac{1}{1 + e^{\left(-a\right) + b}}} \]
  11. Taylor expanded in b around 0 65.8%

    \[\leadsto \frac{1}{\color{blue}{1 + e^{-a}}} \]
  12. Applied egg-rr43.6%

    \[\leadsto \color{blue}{0} \]
  13. Final simplification43.6%

    \[\leadsto 0 \]
  14. Add Preprocessing

Developer target: 100.0% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \frac{1}{1 + e^{b - a}} \end{array} \]
(FPCore (a b) :precision binary64 (/ 1.0 (+ 1.0 (exp (- b a)))))
double code(double a, double b) {
	return 1.0 / (1.0 + exp((b - a)));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = 1.0d0 / (1.0d0 + exp((b - a)))
end function
public static double code(double a, double b) {
	return 1.0 / (1.0 + Math.exp((b - a)));
}
def code(a, b):
	return 1.0 / (1.0 + math.exp((b - a)))
function code(a, b)
	return Float64(1.0 / Float64(1.0 + exp(Float64(b - a))))
end
function tmp = code(a, b)
	tmp = 1.0 / (1.0 + exp((b - a)));
end
code[a_, b_] := N[(1.0 / N[(1.0 + N[Exp[N[(b - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{1 + e^{b - a}}
\end{array}

Reproduce

?
herbie shell --seed 2024011 
(FPCore (a b)
  :name "Quotient of sum of exps"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ 1.0 (exp (- b a))))

  (/ (exp a) (+ (exp a) (exp b))))